it words just fine in studio when i test the game but online the gui doesn't come up when you touch the brick
heres the script:
local Part = script.Parent local Player = game.Players.LocalPlayer Part.Touched:connect(function() game.Players.LocalPlayer.PlayerGui.Shop.Frame.Visible = true end)
Hey beastboy8171,
ServerScript
and you can't access LocalPlayer
from ServerScript
s and you can't use LocalScript
s in the server. You must only use ServerScript
s in the server and you must only use LocalScript
s in the Client
. But, there's a solution to how you can go about getting the player from the Server Script
and be able to do what you are doing, just from a simple ServerScript
. The event .Touched
has a parameter of the part which is touching. In order to get to the Player
, you must make sure that the part which is touching is from the Character
of a player. This is most commonly checked by checking if you can find the object Humanoid
inside of the parent of the part which is touching. So, all you have to do is use the :FindFirstChild()
method for the part's parent and try to see if it contains a Humanoid. Here is the wiki page about that method and below is a personal example.local hum = part.Parent:FindFirstChild("Humanoid")
Part
is from a Character
. So, you can easily define Character
as being the object's parent. Now, here you might get introduced to a new method that you didn't know about. Let me introduce you to a simple method you can use to get the Player
from the Character
. It's called :GetPlayerFromCharacter
I know right, pretty simple. Here is the wiki page for it and below is a personal example.local character = part.Parent local player = game:GetService("Players"):GetPlayerFromCharacter(character)
PlayerGui
and find what you need and mutate it's properties as you may like. I hope this helped and have a great day/night.~~ KingLoneCat