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

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

Asked by 5 years ago
Edited 5 years ago

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!

0
What is IfRed? is it an object? and youre missing a then starmaq 1290 — 5y
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 Vulkarin 581 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
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)
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. ayeayeCommsta 24 — 5y
Ad

Answer this question