function onTouched (part) local h = part.Parent:findFirstChild("Humanoid") local gui = game.Players.LocalPlayer.PlayerGui.ScreenGui if h~= nil then gui.BG.Visible = true gui.No.Visible = true gui.Question.Visible = true gui.Yes.Visible = true script.Parent.Transparency = 0 end end script.Parent.Touched:connect(onTouched)
((Basically this script opens up 3 guis when the brick the script is in is touched))
Ideas? Comments?
LocalPlayer can only be accessed by localscripts. This is looking for the local player but there is none because it can't access it.
Try getting the player from the humanoid using :GetPlayerFromCharacter
function onTouched (part) local Humanoid = part.Parent:findFirstChild("Humanoid") if Humanoid ~= nil then local Gui = game.Players:GetPlayerFromCharacter(Humanoid.Parent) Gui.BG.Visible = true Gui.No.Visible = true Gui.Question.Visible = true Gui.Yes.Visible = true script.Parent.Transparency = 0 end end script.Parent.Touched:connect(onTouched)
This will get the player from the parent of the humanoid. Tell me if there's any problems.