Hello, I've been working on this script for a few days now, but it's not working. This script is meant to print a message if a MeshPart is hitting the Part.
Here's a picture of when this is meant to happen: Here
script.Parent.Touched:Connect(function(hit)
local h = hit
if (h ~= nil) then
if h:IsA("MeshPart") then
print(h.Name.."hit me!")
game.ReplicatedStorage:WaitForChild("vals"):WaitForChild("Winner").Value = h.Name
script.Parent:Destroy()
end
end
end)
Any help would be appreciated. Thanks in advance!

2 comments
Why do you have parenthesis around the argument on line 3
idk if Lua accepts that syntax, but you could be getting an error from it which would explain why it doesn't print anything