Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- si quieres agregar mas camaras solo crea mas camaras del la part que creastes, no necesitas ponerle mas codigo obiamente llamando las demas 4, 5, 6 y asi con las que crees.
- local plr = game.Players.LocalPlayer
- local char = plr.Character or plr.CharacterAdded:Wait()
- local cam = workspace.CurrentCamera
- local function alphabeticalOrder(instance)
- local children = instance:GetChildren()
- table.sort(children, function(c1, c2)
- return c1.Name:lower() < c2.Name:lower()
- end)
- return children
- end
- local camParts = alphabeticalOrder(workspace.Cameras)
- local LArrow = script.Parent.LeftArrow
- local RArrow = script.Parent.RightArrow
- local arrowClickCooldown = false
- char:WaitForChild("Humanoid").Seated:Connect(function(isSeated, seat)
- if not isSeated or seat.Name ~= "CameraSeat" then
- script.Parent.LeftArrow.Visible = false
- script.Parent.RightArrow.Visible = false
- cam.CameraType = Enum.CameraType.Custom
- return
- end
- script.Parent.LeftArrow.Visible = true
- script.Parent.RightArrow.Visible = true
- cam.CameraType = Enum.CameraType.Scriptable
- cam.CFrame = camParts[1].CFrame
- local camNumber = 1
- RArrow.MouseButton1Click:Connect(function()
- if arrowClickCooldown then return end
- arrowClickCooldown = true
- if camNumber == #camParts then
- cam.CFrame = camParts[1].CFrame
- camNumber = 1
- else
- cam.CFrame = camParts[camNumber + 1].CFrame
- camNumber = camNumber + 1
- end
- wait(0.1)
- arrowClickCooldown = false
- end)
- LArrow.MouseButton1Click:Connect(function()
- if arrowClickCooldown then return end
- arrowClickCooldown = true
- if camNumber == 1 then
- cam.CFrame = camParts[#camParts].CFrame
- camNumber = #camParts
- else
- cam.CFrame = camParts[camNumber - 1].CFrame
- camNumber = camNumber - 1
- end
- wait(0.1)
- arrowClickCooldown = false
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement