I have this script, and it works fine (for the most part) but when I touch it, it senses the hats also, how would I make it only take the characters name?
function onTouch(hit)
if game.Workspace.Positions.First.Value == "" then
game.Workspace.Positions.First.Value = hit.Parent.Name
elseif game.Workspace.Positions.Second.Value == "" then
game.Workspace.Positions.Second.Value = hit.Parent.Name
elseif game.Workspace.Positions.Third.Value == "" then
game.Workspace.Positions.Third.Value = hit.Parent.Name
wait(1)
game.Workspace.Positions.Last.Value = true
end
end
script.Parent.Touched:connect(onTouch)

3 comments
Thanks!
The Hat check isn't needed. Hat's don't have Humanoids.
... I did the hat check so if the part is touched by a hat, it does not continue, because that's what he asked, and for the humanoid check, I am checking if the parent has a humanoid, not if hat has the humanoid, if I don't put the hat check, it will work if it's touched by a hat, which he doesn't want.