Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

This script only works for ting = 2?

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)

1 comment

0

Tab your code, and you'll catch the little things easier.

1 answer

✓ Accepted answer

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)

2 comments

0

Lol, the little things sometimes, thanks!

0

No problem, I always have to pour over my scripts for mistakes like these.

This discussion is preserved as it was. New answers, comments, and votes are closed.