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

How do i make this script work?

Asked by 9 years ago

I am trying to make it to where when i press this button it locks me in first person but for some reason when i put script.Parent.Active = true it has a red squiggly line under the = sign saying Expected 'then', got '='

Script:

script.Parent.Parent.Parent.Parent.CameraMode="LockFirstPerson"

function onBananaClicked()
    if script.Parent.Disabled = true then game.StarterGui.ScreenGui.Frame.Beep.FirstPerson.Disabled = true 
    end 

script.Parent.MouseButton1Click:connect( onBananaClicked)

The 4 script.parents are caused because the button is inside a frame, inside a gui, inside the startergui, and thats inside the game.

Please help!

0
What is the part after 'then' on line 4 for? Goulstem 8144 — 9y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

In the if statement on line 4, you wrote if script.Parent.Disabled = true then instead of if script.Parent.Disabled == true then (or if script.Parent.Disabled then)

You're also missing an end on line 6 to end the function.

0
Thanks! speed5231 5 — 9y
Ad

Answer this question