Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --> Made by Stefan#6965
- local lp = game:GetService("Players").LocalPlayer
- local cam = game:GetService("Workspace").CurrentCamera
- local CameraPart = game:GetService("Workspace"):WaitForChild("Client"):WaitForChild("CameraPos")
- local CurrentObject = nil
- local folder = game:GetService("Workspace"):WaitForChild("Client"):WaitForChild("Cubes")
- local ms = lp:GetMouse()
- local function Find(arr)
- local POS = CameraPart.Position
- local bestpos = 100000000000000
- local bestpart = nil
- for i,v in pairs(arr) do
- if v.Name == "Cube" and v:IsA("Part") and (POS - v.Position).magnitude < bestpos then
- bestpos = (POS - v.Position).magnitude
- bestpart = v
- end
- end
- return bestpart
- end
- spawn(function()
- while true do
- local cubes = folder:GetChildren()
- local BestPart = Find(cubes)
- CurrentObject = BestPart
- wait()
- end
- end)
- repeat wait() until CurrentObject ~= nil
- while true do
- cam.CFrame = CFrame.new(CameraPart.Position,CurrentObject.Position)
- wait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement