Hey, I'm a new scripter, I just started like 2 days ago. Im making a basic starting obby game. I made this script for a overhead GUI with the help of Alvinblox plus some minor additions of my own. I want it where the overhead GUI changes the text when the player reaches the next level (team) the following script does work however it does not change the overhead GUI as the player changes team but after they die and respawn. Im trying to make it where the overhead gui changes as the player reaches the new level even if they do not die.
Script: local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
``` player.CharacterAdded:Connect(function(character)
-- Stage 1 starts
if player.Team == game.Teams.Start then local clonedgui = billboardgui:Clone() clonedgui.TextLabel.Text = "Start" clonedgui.TextLabel.TextColor3 = Color3.fromRGB(61,232,14) clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head end
-- Stage 1 ends
--- Stage 2 starts
if player.Team == game.Teams["Stage 2"] then
local clonedgui = billboardgui:Clone() clonedgui.TextLabel.Text = "Stage 2" clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0,16,176) clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head end
-- Stage 2 ends
end)
```
end)
It only changes when the player dies because you're only telling it to run when the player's character is added. Make the function activate whenever the player's team switches.
The parent of the Cloned Bilboard GUI should be:
clonedgui.Parent= game.Players:FindFirstChild(player.name):FindFirstChild("PlayerGui")