Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

PlayerGui a nil value ??

Asked by 4 years ago
Edited 4 years ago

I was making a pop up gui (the script not made by me) when I test it in other place in studio, it works, when I test it in the game I want it, it says this: 19:21:59.127 - Workspace.TeleportBrick.PopupScript:9: attempt to index local 'plyr' (a nil value) (At line 9)

Code:~~~~~~~~~~~~~~~~~

Popup = script.Parent.AccessUI
Ready = true
function onTouch(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h ~= nil and Ready == true then
Ready = false
local plyr = game.Players:FindFirstChild(h.Parent.Name)
local c = Popup:clone()
c.Parent = plyr.PlayerGui
Ready = true
end
end

script.Parent.Touched:connect(onTouch)

~~~~~~~~~~~~~~~~~

0
use GetPlayerFromCharacter() on h.Parent instead of trying to search Players for the player DeceptiveCaster 3761 — 4y

Answer this question