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

text changer else problem help?

Asked by
raid6n 2196 Moderation Voter Community Moderator
5 years ago

Here's the script

script.Parent.MouseButton1Click:connect( function()
if not script.Parent.Text == "On" then
    script.Parent.Text = "On"
elseif not script.Parent.Text == "Off" then
     script.Parent.Text = "Off"
end
end)

help please

0
Also you spaced you function...... voidofdeathfire 148 — 5y
0
Just gotta add that because it might cause some problems in your script voidofdeathfire 148 — 5y
0
also "connect' is deprecated voidofdeathfire 148 — 5y
0
Spaced function won't cause any problems karlo_tr10 1233 — 5y

2 answers

Log in to vote
1
Answered by
0msh 333 Moderation Voter
5 years ago

see if that works

script.Parent.Text = "Off"
script.Parent.MouseButton1Click:Connect(function()
    if script.Parent.Text == "On" then
        script.Parent.Text = "Off"
    elseif script.Parent.Text == "Off" then
        script.Parent.Text = "On"
    end
end)

Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Just change the variable for it. Normally people don't write not infront of the if statement but instead by the equal sign..

script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
if script.Parent.Text ~= "On" then
    script.Parent.Text = "On"
elseif not script.Parent.Text ~= "Off" then
     script.Parent.Text = "Off"
end
end)
0
You don't need to change anything on this script just copy and paste it voidofdeathfire 148 — 5y

Answer this question