Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i break a renderstepped loop on a keypress?

Asked by
Kblow1 53
6 years ago
Edited 6 years ago

So i made a script that makes your CurrentCamera follow a part. Now i have this in a loop so that it will auto-update. Is there a way i can set CurrentCamera to Custom on a KeyPress without having the camera go back to following the part? Aka breaking the loop to follow the part.

Thanks!

EDIT:

local Mouse = game.Players.LocalPlayer:GetMouse()
local playerz = game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
local offset = Vector3.new(0,15,0)

Mouse.KeyDown:Connect(function(key)
    if key == "f" then
        if playerz:FindFirstChild('Humanoid') then
        playerz.Head.CFrame = CFrame.new(workspace.Plane.Plane.SpawnPart.Position)
        game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
        end
    end
end)

game:GetService("RunService").RenderStepped:Connect(function()
repeat
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.PART.CFrame + offset
end)
0
can you include your code User#5423 17 — 6y
0
Please include your code, thanks. User#21527 0 — 6y
0
Done! Kblow1 53 — 6y
0
Please Help! Kblow1 53 — 6y

Answer this question