I'm trying to make a GUI pop up for people who touch the hitbox of a shop, and I put the localscript for it inside a folder that is in the playergui, which is my script storage. Here is the code
local last = 0
workspace.Shop.CrateShop.CrateShopTouch.Hitbox.Touched:Connect(function(hit)
if tick() - last <= 1 then
else
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum ~= nil then
local plr = hum.Parent.Name
local plrC = game.Players:FindFirstChild(plr)
if plrC.PlayerGui.ScreenGUI:FindFirstChild("CrateShopMenu") == nil then
local newCrateMenu = game.ReplicatedStorage.Storage.GUIObjects.CrateShopMenu:Clone()
newCrateMenu.Parent = plrC.PlayerGui.ScreenGUI
elseif plrC.PlayerGui.ScreenGUI:FindFirstChild("CrateShopMenu") ~= nil then
end
end
end
last = tick()
end)
When the local player touches it, it's doesn't send any errors their way, but it sends out an error for everyone else. If it isn't the local player that is touching it, it sends out something like this "PlayerGui is not a valid member of Player" "Begin" "Players.[LocalPlayerName].PlayerGui.Scripts.ShopTouch Line 11" "End"
where localplayername is, it just shows the name of your player, no matter who touched it.

2 comments
Review it carefully. Either this error might actually be unavoidable and you'd need to use a different way, or there was a small error that might have actually screwed it up.
is this script a localscript?