Hey, how do you create a script that changes all Player GUIs at once in a server? I have tried, but I am only a basic scripter and don't know much at all.
local playerss = game.Players:GetChildren() local m = playerss.titel.fram.label while true do m.Text = "Testing" end
That's the code I made up, and it doesn't work. Does anyone know how to make scripts that change Player guis?
Hey there Dylan!
So, your playerss
variable is a table that was passed in by GetChildren()
, and you therefore need to loop through it, like so:
local playerss = game.Players:GetPlayers() -- Just in case there are children that aren't players while true do for i, v in pairs(playerss) do -- loop through players local m; local playergui = playerss:findFirstChild("PlayerGui"); -- UI is found in the PlayerGui if(playergui and playergui:findFirstChild("titel")) then if(playergui.titel:findFirstChild("fram")) then if(playergui.titel.fram:findFirstChild("label")) then m = playergui.titel.fram.label; -- get label from each playergui end end end if(m) then -- make sure the label exists m.Text = "Testing"; end end end
I added in a few if-statements so that you could check to make sure that each element existed, and avoid any errors.
Some of the code might be a bit beyond the scope of 'beginner scripting', but I'd urge you to try looking into anything there that you don't fully understand :P