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)
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!")