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

Whats Wrong with this script?

SH = SpaceHat


script.Parent.Touched:connect(function(hit)
if 	hit.Parent:FindFirstChild(SH) ~= nil then
	hit.Parent.Head.BrickColor = BrickColor.new("White")
	hit.Parent.Head.face:remove()
	hit.Parent.Head:BreakJoints()
	
end
end)

SH = SpaceHat

Please help.

1 answer

✓ Accepted answer

i think you need to put quotation marks on the word SpaceHat like this.

SH = "SpaceHat"

and you need to remove the word "Head" on line 8 and it should be like this:

hit.Parent:BreakJoints()

because BreakJoints only works on Model.

the script should be like this:

SH = "SpaceHat"


script.Parent.Touched:connect(function(hit)
if  hit.Parent:FindFirstChild(SH) ~= nil then
    hit.Parent.Head.BrickColor = BrickColor.new("White")
    hit.Parent.Head.face:remove()
    hit.Parent:BreakJoints()

end
end)

i hope it helps.

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