What I am trying to do is when a player touches a part then the frame pops up on their own screen. The script is located in a part.
Part = script.Parent
Part.Touched:connect(function()
game.Players.Name.PlayerGui.Gui.Frame.Visible = 0
end)
What I am trying to do is when a player touches a part then the frame pops up on their own screen. The script is located in a part.
Part = script.Parent
Part.Touched:connect(function()
game.Players.Name.PlayerGui.Gui.Frame.Visible = 0
end)
Your main issue is that when you do game.Players.Name it returns the name of the player. There is no item in Player named NAME, therefore you cannot get the PlayerGui.
To get to the player gui you must do something like this:
Part = script.Parent
Part.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.Players[hit.Parent.Name].PlayerGui.Gui.Frame.Visible = false -- Visible needs a bool
end
end)
this will actually get the players gui. I think what you wanted was to actually get the players name and use that to find children inside Players.
Hope this helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.