so i want to update the playergui every second to the guis in the starter gui without needing them to die for it to update. how can i do that?
test this to grab some knowledge about the issue
so i want to update the playergui every second to the guis in the starter gui without needing them to die for it to update. how can i do that?
test this to grab some knowledge about the issue
its on check lol but what i mean in my question i don’t want it to reset on spawn only i want it to reset everysecond
Oh, my bad. I read the post wrong.
What are you trying to reset? It’s really unclear as to what you are trying to accomplish without proper context
Do you want the UI to update as in adding elements and removing elements?
you’ll know what i’m talking about if you played this i have problem with the progress bar here
If you want the progress to change, you can either loop
your code that deals with the progress bar OR you can use events that trigger when a value is changed such as .Changed
i tried using this
local players = game:GetService("Players")
for i,v in pairs(players:GetChildren()) do
v.CharacterAdded:Connect(function(char)
for i,v in pairs(game:GetService("Players"):GetChildren()) do
for x,y in pairs(v.PlayerGui.HeightGui:GetChildren()) do
for a,b in pairs(game.StarterGui.HeightGui:GetChildren()) do
wait()
y = b
end
end
end
end)
end
so that when a player dies it resets everyone’s gui but it doesn’t work
i also tried usiing this
for i,v in pairs(game:GetService("Players"):GetChildren()) do
for x,y in pairs(v.PlayerGui.HeightGui:GetChildren()) do
for a,b in pairs(game.StarterGui.HeightGui:GetChildren()) do
while wait() do
y = b
end
end
end
end
to update the gui everytime but it doesn’t work
Use a server script to remove the current GUIs and replicate starter guis back to the client.
-- Remove a player's current GUIs:
for _, currentGUI in pairs (player.PlayerGui:GetChildren()) do
currentGUI:Destroy()
end
-- Then clone the GUIs:
for _, GUI in pairs (game.StarterGui:GetChildren()) do
GUI:Clone().Parent = player.PlayerGui
end
Then wrap this code in a loop. But your post is too vague and we don’t know the context or your purpose of doing this. Hope this helped.
still not updating the player’s gui
its still the same result as my other script
Could you show the output messages if there are any errors?
09:50:24.921 - Infinite yield possible on 'RobloxReplicatedStorage:WaitForChild("GetServerVersion")'
09:50:24.923 - Stack Begin
09:50:24.931 - Script 'CoreGui.RobloxGui.CoreScripts/CoreScriptErrorReporter', Line 104
09:50:24.932 - Stack End
Resetted
there are no errors on the script
The code works just fine for me. Try this test snippet and update us on the output logs.
local player = game.Players:WaitForChild("g_captain") -- change to your username
while true do
for _, currentGUI in pairs (player.PlayerGui:GetChildren()) do
currentGUI:Destroy() print(currentGUI.Name)
end
-- Then clone the GUIs:
for _, GUI in pairs (game.StarterGui:GetChildren()) do
GUI:Clone().Parent = player.PlayerGui print(GUI.Name)
end
wait(1)
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
for _, currentGUI in pairs (plr.PlayerGui:GetChildren()) do
if currentGUI:IsA("ScreenGui") then
currentGUI:Destroy() print(currentGUI.Name)
end
end
for _, GUI in pairs (game.StarterGui:GetChildren()) do
if GUI:IsA("ScreenGui") then
GUI:Clone().Parent = plr.PlayerGui print(GUI.Name)
end
end
end)
end)
its doesn’t print anything so its not working i guess
It should be a server script try that as @g_captain i just copied what you said at the first script you send
yeah i placed it in serverscript service
Then the code is not the issue. Is your ServerScript disabled? Is it in ServerStorage? Try making an entirely new script and placing only the code there.
it is still the same as the script i’m using before
so you mean you want your bar progress to update everytime ?