I need to access the player gui to enable a message to be displayed on their screen when they touch a part but I'm unsure how to do it. Can anyone please help?
Normally, you can access the character without a problem but I don't know how to get the player.
The GetPlayerFromCharacter
function returns the Player
associated with the given character
.
So to get the player from a touched
event you would do something like this:
local part = workspace.Part part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then -- part belongs to character local player = game.Players:GetPlayerFromCharacter(hit.Parent) end end)
That's it, you got your player.
Hope I helped, if you have any questions please let me kno1!
Please watch this video first https://www.youtube.com/watch?v=4beMzJ1GInI