Hello, my Roblox Gui Shop opens when I single player play test it using the Proximity Prompt but whenever I play test with multiple people it doesn’t work. I have a remote event in replicatedstorage named “openShop”, please tell me if this is wrong because I do not know if I did this correctly.
Script in side proximity prompt:
game.Players.PlayerAdded:Connect(function(player)
local replicatedStorage = game:GetService("ReplicatedStorage")
local openShopEvent = replicatedStorage:FindFirstChild("openShop")
local openPrompt = script.Parent
local function openShop (player)
openShopEvent:FireClient(player)
end
openPrompt.Triggered:Connect(openShop)
end)
local script in StarterGui:
local replicatedStorage = game:GetService("ReplicatedStorage")
local openShopEvent = replicatedStorage:FindFirstChild("openShop")
local player = game:GetService("Players").LocalPlayer
local playerGui = player.PlayerGui:FindFirstChild("shopGui")
local function openShop ()
if playerGui.Enabled == false then
playerGui.Enabled = true
else
playerGui.Enabled = false
end
end
openShopEvent.OnClientEvent:Connect(openShop)