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

Script.Parent.Touched:Connect() not seeming to function properly?

My script that I wrote that shows no sign of error is not working. Could anyone explain to me why this is? Any help would be appreciated!

function OnTouch(hit)
	print(hit.Name.."hit me!")
    if hit:IsA("MeshPart") then
       print(hit.Name.."hit me!")
       game.ReplicatedStorage:WaitForChild("vals"):WaitForChild("Winner").Value = hit.Name
       script.Parent:Destroy()
    end
end

script.Parent.Touched:Connect(OnTouch)

1 answer

✓ Accepted answer

I assume you are trying to get the character that hit the part, if so you should check all parts that hit it if their parent is a players character. If you could explain your problem further it would be helpful, is it printing?

print(hit.Name.."hit me!")

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