When the character touches a brick a GUI becomes visible.
I tried the GetPlayerFromCharacter method but the output is **22:05:01.018 - GetPlayerFromCharacter is not a valid member of Model 22:05:01.019 - Script 'Workspace.Part.Script', Line 4 22:05:01.021 - Stack End****
Here is the code
function onTouch(brick) local p = brick.Parent:findFirstChild("Humanoid") if p ~= nil then p.Parent:GetPlayerFromCharacter() end end script.Parent.Touched:connect(onTouch)
The GetPlayerFromCharacter
funtion is a function of game.Players
and uses the character you're wanting to get the player from as it's arguments!
function onTouch(brick) local p = brick.Parent:FindFirstChild("Humanoid") if p ~= nil then local plr = game.Players:GetPlayerFromCharacter(brick.Parent) end end script.Parent.Touched:connect(onTouch)
EDIT
If you need to get the PlayerGui
of the player, the PlayerGui is a child of the Player.. so just index it like `plr.PlayerGui``