debounce = false function onTouched(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr and debounce == false then debounce = true plr:WaitForChild("PlayerGui").ShopGui.Frame.Visible = true debounce = false end end script.Parent.Touched:connect(onTouched)
how touch part open shop did not work
The script does not work because there is no shop gui in the PlayerGui for the server this can only be used via local script (or with a remote function)
local RemoteEvent = Instance.new("RemoteEvent") RemoteEvent.Parent = game.Workspace RemoteEvent.Name = "ShopEvent" function onTouched(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) RemoteEvent:FireClient(plr) end script.Parent.Touched:Connect(onTouched)
this script is placed in the brick
game.Workspace:WaitForChild("ShopEvent") local debounce = false game.Workspace.ShopEvent.OnClientEvent:Connect(function () if debounce == false then script.Parent.Frame.Visible = true debounce = true end end)
this script is placed in a local script in the shop gui