Reposted due to no answers being posted on my last post. So what this script is supposed to do is make a GUI pop up when a part is touched. It isn't working, why? Here is my script:
local Part = script.Parent Part.Touched:connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local Player = game.Players:GetPlayerFromCharacter(HIT.Parent) Player.PlayerGui.ScreenGui.Frame.Visible = true end end)?
You can only alter the gui through a local script, and local scripts only run when inside something that is individual to the player, such as their PlayerGui.
To fix this, you can move it to a local script inside StarterGui and do something like this:
local Part = workspace.Button --change to directory of button Part.Touched:Connect(function(hit) if hit.Parent == game.Players.LocalPlayer.Character then game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true end end)