So, I got a folder where I got script for the game "round": choosing map and gamemode, making teams, timers, intermission, etc. It itself works properly, but the user interface bugs. It works in studio playmode but when you go to the site and click play, the character somewhy starts at below the lobby, at that point you can see the GUI, but when your character respawns, it disappears, with no errors. I have tried setting the ResetGuiOnSpawn on and off for players, but that didn't make diffrence.
My setup has 1 server script and inside it there are modules for every gamemode. Then I also have a local script and I use remote event to write through the local script to the text label.
The activation code for the event looks like this:
function _G.fire(msg) RUI_event:FireAllClients(msg) end
I use it, for instance, like this:
_G.current_board = "Map: ".. map _G.fire(_G.current_board)
where _G.current_board
is either the last string fired with the _G.fire
or an empty string and map is the name of the current map.
The local script, which is stored in players backpack(also tried storing in the GUI)
local player = game.Players.LocalPlayer local gui = player.PlayerGui:WaitForChild("GUI_MAIN") --the gui where's the text label local board = gui:WaitForChild("Board") --text label local storage = game.Workspace:WaitForChild("scripts") --[[the event is stored in the same place as is the script that fires the event--]] local event = storage:WaitForChild("RUI_event") --this is the event's name event.OnClientEvent:connect(function(msg) board.Text = msg end)
is ran on every player. It writes on the text label, based on what is sent from the server script. I have tried this many diffrent ways, but without event, I thought maybe server can't see GUIs, 'cause it complained about not finding one and before I knew the use of FireAllClients, I made invidual events for each player, they worked also on the play mode as I mentioned this did, but didn't work when you play on the site.
If you find out/know the solution, please answer this question.
Thanks,
SwaggyDuckie
I found out why it wasn't working: the CharacterAdded wasn't fast enough, so the gui had not loaded once player respawned. This could've probably be fixed by testing these functions I gave, but I'm happy that it's now solved.