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

How do break a camera interpolation loop when a button is pressed???

Asked by 5 years ago
Edited 5 years ago

I would like to make such a Camera Script (please click here and play to see the Main Menu), but all my attempts to copy it have failed. Do you have a solution please? --Edited New: I finally managed to imitate the loop, but that with the PlayButton that the loop should break once clicked still does not work. Here is the script:

-- made 100% of Eternalovefan_32--
--script in workspace
local RE = game.ReplicatedStorage.RE

game.Players.PlayerAdded:Connect(function(player)
    wait(10)
    RE:FireClient(player)
end)

--local script in StarterGui
game.ReplicatedStorage.RE.OnClientEvent:Connect(function()
    local camera = workspace.CurrentCamera
    local Player = game.Players.LocalPlayer
    camera.CameraType = "Scriptable"
    while true do   
        camera:Interpolate(workspace.Part1.CFrame, workspace.Part2.CFrame, 2)
        wait(2)
        camera:Interpolate(workspace.Part2.CFrame, workspace.Part3.CFrame, 2)
        wait(2)
        camera:Interpolate(workspace.Part3.CFrame, workspace.Part4.CFrame, 2)
        wait(2)
        camera:Interpolate(workspace.Part4.CFrame, workspace.Part5.CFrame, 2)
        wait(2)
        camera:Interpolate(workspace.Part5.CFrame, workspace.Part6.CFrame, 2)
        wait(2)
    end
end)
-- local script in a textbutton
script.Parent.MouseButton1Click:Connect(function()
    local Player = game.Players.LocalPlayer
    game.ReplicatedStorage.RemoteEvent:FireServer(Player)
end)

-- Script in workspace
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player)
    repeat wait()
        game.Workspace.CurrentCamera.CameraType = "Custom"
    until
    game.Workspace.CurrentCamera.CameraType == "Custom"
end)

Did you find the mistake ???

0
"Scripting Helpers is a good resource when issues arise, but we are not here to script your game for you." Unhumanly 152 — 5y
0
Yes you have right. I forgot the script. Eternalove_fan32 188 — 5y
0
tomorrow will i add my broken script. Eternalove_fan32 188 — 5y
0
here Eternalove_fan32 188 — 5y

Answer this question