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

Why is this script not working?

Asked by 10 years ago

So I have a script. If the person is on fire, they lose health, then die. But the output says 20:08:59.458 - Workspace.Script:1: 'then' expected near '='. Why?

if Effects.Fire = true then
    wait(5)
    game.Workspace.USERNAME.Humanoid.Health = 5
    wait(4)
    game.Workspace.USERNAME.Humanoid:Destroy()
end

2 answers

Log in to vote
1
Answered by
Link43758 175
10 years ago

When comparing two things, you use the == operator. Compare two statements like this:

if Effects.Fire == true then
Ad
Log in to vote
0
Answered by 10 years ago
if Effects.Fire == true then
wait(5)
game.Workspace.USERNAME.Humanoid.Health = 5
wait(4)
game.Workspace.USERNAME.Humanoid:Destroy()
end

You need the "==" because your comparing. In other situations you might need a "~="

if (humanoid ~= nil) then

I used the "()" in it. You don't have to.

Answer this question