Im developing a hockey game and when someone scores I want to make it so it will say goal scored by (Name) and assisted by (name) and (name) but I dont know how to find the players that last hit the puck.
COMMUNITY QUESTION
Ontouch player name finder?
1 answer
Let me know if this works.
function onTouched(part)
if part.Parent:FindFirstChild("Humanoid") then
local name = part.Parent.Name
print(name) --change this to display the name wherever (GUI, etc.)
end
end
script.Parent.Touched:connect(onTouched)
Put this script inside the part (goal).
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Tag it. When the puck is touched, check if it was by a Player Character. If it was, record it. Check the records when your goal is scored.