Do I put the GUI in server storage or in Starter Gui?
1 Like
Event.OnServerEvent:Connect(function(plr,RaceClick)
for index,player in pairs (game.Players:GetPlayers()) do
--You can enable a GUI through their PlayerGui Folder, as long as it's in StarterGui and you have `ResetOnRespawn` on, you'll be fine, else you'll have to add it again if ever removed.
if player.PlayerGui:FindFirstChild(RaceClick) then
player.PlayerGui[RaceClick].Visible = true --Use this if it's a Frame
else
local GUI = game.ServerStorage[RaceClick]:Clone()
GUI.Parent = player.PlayerGui
GUI.Visible = true --Use this if it's a Frame
end
end
end)``` This is my script rn, it's not working, is there anything I can fix?
1 Like
Event.OnServerEvent:Connect(function(plr,RaceClick)
for index,player in pairs (game.Players:GetPlayers()) do
--You can enable a GUI through their PlayerGui Folder, as long as it's in StarterGui and you have `ResetOnRespawn` on, you'll be fine, else you'll have to add it again if ever removed.
if player.PlayerGui:FindFirstChild(RaceClick) then
player.PlayerGui[RaceClick].Visible = true --Use this if it's a Frame
else
local GUI = game.ServerStorage[RaceClick]:Clone()
GUI.Parent = player.PlayerGui
GUI.Visible = true --Use this if it's a Frame
end
end
end)```
This is my script, I have the GUI in ServerStorage and the Local Script in the Button I'm using to open it, it does not work, I'm not sure why.
1 Like
Iād recommend having a default one in ServerStorage and then have one in StarterGui so it can be cloned into the PlayerGui folder when joining a game.
1 Like
Put " around the parts that say RaceClick
2 Likes
Stil does not work sadly, know any other problem this is my local code.
script.Parent.MouseButton1Click:Connect(function()
Event:FireServer("RaceClick") --[[Remember, even though you aren't sending it yourself, the first variable will always be the player triggering/sending this signal to the RemoteEvent. I'm assuming you put your local script into the button you're using.]]
end)```
2 Likes
Make a server script that when they click a click detector it fires a remote event to all clients with :FireAllClients() then in a local script do onclientevent then enable the GUI
1 Like