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

Why is my head not getting removed when i click the tool? (SOLVED)

If the part "Ifred" is = red then it should be removing my head but it dosen't work, what did i do wrong?

(Inside a tool, localscript, the brick is called "Ifred")

script:

script.Parent.Activated:Connect(function()
	if workspace.IfRed == BrickColor.new("Really red") then
		game.Players.LocalPlayer.Character.Head:Remove()
	else
		print("Nope it's not red, puh")
	end
end)

i tried if workspace.IfRed == BrickColor = BrickColor.new("Really red") but that wont work.

Help would be appreciated!

2 comments

0

What is IfRed? is it an object? and youre missing a then

0

You need to do workspace.IfRed.BrickColor, IfRed is just an object. As ayeayeCommsta mentioned, doing this in a localscript isn't going to replicate so you'll most likely want to change this to a script instead and reference Character differently

1 answer

✓ Accepted answer
script.Parent.Activated:Connect(function()
    if workspace.IfRed.BrickColor == BrickColor.new("Really red") then
        game.Players.LocalPlayer.Character.Head:Remove()
    else
        print("Nope it's not red, puh")
    end
end)

If this is a local script, this works. If this is a normal script. This needs to be there instead.

script.Parent.Activated:Connect(function()
    if workspace.IfRed == BrickColor.new("Really red") then
        script.Parent.Parent.Head:Remove()
    else
        print("Nope it's not red, puh")
    end
end)

1 comment

0

Keep in mind, local script only show up for the actual player, not to the entire server. So i recommend using scripts if you want all players to see it.

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