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)

1 comment
use GetPlayerFromCharacter() on h.Parent instead of trying to search Players for the player