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

Button that disables this script not working?

Asked by 8 years ago

So i have a fixed camera script for when the player spawns/dies shown below:

---Locked---
plr=game.Players.LocalPlayer
cam=game.Workspace.CurrentCamera
chr=nil

plr.CharacterAdded:connect(function(character)
    chr=character
end)

while true do
    wait()
    cam.CameraType=0 -- Type is Fixed
    cam.CoordinateFrame=CFrame.new(200,10,0)
    cam.Focus=CFrame.new(200,0,0)
end

And i'm making a button that will disabled the locked camera script and bring back the players normal camera. So inside my StarterGui i have the script shown above, a ScreenGui with a button on the inside called: "Byebutton" which is the button that is supposed to disable the script. Inside the button i have this script:

--Unlock---
button=game.StarterGui.ScreenGui.Byebutton
function onClicked(Byebutton)
    game.StarterGui.CamerLock:
script.Parent.ClickDetector.MouseClick:connect(onClicked)
end

What am i doing wrong?

0
Anyone have any ideas on how to do this? IdeaBrick 15 — 8y

Answer this question