this script, changes the camera to a part when pad is touched, after three seconds the RenderStepped disconnects and it returns to the normal player camera.
pad.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local CurrentlyTeleporting = player.Character:FindFirstChild("CurrentlyTeleporting")
if not CurrentlyTeleporting then return end
if not CurrentlyTeleporting.Value then
CurrentlyTeleporting.Value = true
player.Character.HumanoidRootPart.CFrame = pad2.CFrame + Vector3.new(0, 5, 0)
local connection
connection = game:GetService("RunService").RenderStepped:Connect(updateCamera)
task.wait(3)
connection:Disconnect()
setBackCamToPlr()
CurrentlyTeleporting = false
end
end
end)
these are the functions:
function setBackCamToPlr()
warn("Setting camera back")
camera.CameraType = Enum.CameraType.Custom
local HUM = player.Character.Humanoid
camera.CameraSubject = HUM
end
function updateCamera()
camera.CFrame = game.Workspace.HomeCamera.CFrame
end
How would I make it so after the three seconds the pad can be touched again so it will do all this over again?