I get this error in output: 17:41:04.203 - Workspace. .Talk.Script:3: attempt to index local 'plr' (a nil value) but I don't see any of those "red lines" in the script, and I have no idea why its saying plr isn't a variable.
Script:
script.Parent.Touched:connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if hit.Parent.ClassName == "Hat" and plr.PlayerGui.Talk then
print("...")
else
h = hit.Parent.Humanoid
if h ~= nil then
game.ReplicatedStorage.Talk:Clone().Parent = plr.PlayerGui
end
end
end)
