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

This script only works for ting = 2?

Asked by 9 years ago
ting = 1

function click()
    if ting == 1 then
    Note = game.Workspace:WaitForChild(script.Parent.Parent.Tool.ToolTip)
    Note.Script.Disabled = true
    Note.Move.Disabled = true
    Note.Torso.BodyPosition.position = Vector3.new(0,50,0)
    Note.Guy.Anchored = false
    script.Parent.Heal.Disabled = false
    Note["Body Colors"].HeadColor = BrickColor.Red()
    ting = 2
    if ting == 2 then --for some reason it does this when I click, then doesnt go back to ting = 1
    Note = game.Workspace:WaitForChild(script.Parent.Parent.Tool.ToolTip)
    Note.Script.Disabled = true
    Note.Move.Disabled = true
    Note.Torso.BodyPosition.position = Vector3.new(0,5,0)
    script.Parent.Heal.Disabled = false
    Note["Body Colors"].HeadColor = BrickColor.Red()
    ting = 1
    end
    end
end


script.Parent.MouseButton1Click:connect(click)
0
Tab your code, and you'll catch the little things easier. BlueTaslem 18071 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

You're checking for ting2 immediately after ting1. Ting 1 is being fired, but there's no space inbetween. Basically, if you click, it runs ting 1 then immediately runs ting 2. Here's how I'd write it:

ting = 1

function click()
    if ting == 1 then
    Note = game.Workspace:WaitForChild(script.Parent.Parent.Tool.ToolTip)
    Note.Script.Disabled = true
    Note.Move.Disabled = true
    Note.Torso.BodyPosition.position = Vector3.new(0,50,0)
    Note.Guy.Anchored = false
    script.Parent.Heal.Disabled = false
    Note["Body Colors"].HeadColor = BrickColor.Red()
    ting = 2
    elseif ting == 2 then
    Note = game.Workspace:WaitForChild(script.Parent.Parent.Tool.ToolTip)
    Note.Script.Disabled = true
    Note.Move.Disabled = true
    Note.Torso.BodyPosition.position = Vector3.new(0,5,0)
    script.Parent.Heal.Disabled = false
    Note["Body Colors"].HeadColor = BrickColor.Red()
    ting = 1
end
end


script.Parent.MouseButton1Click:connect(click)

0
Lol, the little things sometimes, thanks! BSIncorporated 640 — 9y
0
No problem, I always have to pour over my scripts for mistakes like these. aquathorn321 858 — 9y
Ad

Answer this question