So, when I try to clone a GUI into a player, it works, but it gives me an error. Here is the code:
function touch(hit)
if hit.ClassName == "Part" then
local char = hit.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
if plr.PlayerGui:FindFirstChild("BSGui") == nil then
local gui = game.Lighting.BSGui:Clone()
gui.Parent = plr.PlayerGui
end
end
end
script.Parent.Touched:connect(touch)
Error: Workspace.BSmith_Trigger.Script:5: attempt to index global 'plr' (a nil value) 18:11:53.758 - Stack Begin 18:11:53.758 - Script 'Workspace.BSmith_Trigger.Script', Line 5 18:11:53.759 - Stack End
