Alright so i have an issue. I have a baseball that when thrown will become a child of the workspace. What I want to do is when the baseball is a homerun, it will trigger a message with the person who hit it. I have all of that done except the part with the players name. I don't know how to get the players name who hit it because the parent of the baseball is the workspace.
debounce = false
function onTouched(hit)
local player = --this is where i need help
if hit.Name == "Ball" and debounce == false then
debounce = true
local h = Instance.new("Message")
h.Parent = hit.Parent
h.Text = "Home run hit by"..player.Name
wait(4)
h.Parent = game.Workspace
h:remove()
debounce = false
end
end
script.Parent.Touched:Connect(onTouched)

1 comment
This isn't want i meant, if I could easily name the player localplayer but that when the message would appear, it would name yourself not the player who hit the hr.