Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make this value constantly change?

Asked by 6 years ago

Ok, so this show's your stage level over your head, it works, but when they move on, it doesn't update..

local serverStorage = game:GetService("ServerStorage")
local billBoardGui = serverStorage:WaitForChild("BillboardGui")

game.Players.PlayerAdded:connect (function(plr)

local rank = game.Players.LocalPlayer:WaitForChild("leaderstats" ):WaitForChild("Stage")

    plr.CharacterAdded:connect (function(char)

local   bgc = billBoardGui:Clone()
        bgc.Frame.TextLabel.Text = "Stage: "..rank.Value

        bgc.Parent = workspace:WaitForChild(char.Name) :WaitForChild("Head")
    end)
end)

Example: https://gyazo.com/bd9ca240e5d3adf73767cd2480b35378

Generally i have to reset so it can update to say "Stage 2"

2 answers

Log in to vote
0
Answered by
DevingDev 346 Moderation Voter
6 years ago
Edited 6 years ago

You need to add a Changed event to the value. See if this works.

local serverStorage = game:GetService("ServerStorage")
local billBoardGui = serverStorage:WaitForChild("BillboardGui")

game.Players.PlayerAdded:connect (function(plr)

local rank = game.Players.LocalPlayer:WaitForChild("leaderstats" ):WaitForChild("Stage")

    plr.CharacterAdded:connect (function(char)

    local   bgc = billBoardGui:Clone()
    bgc.Frame.TextLabel.Text = "Stage: "..rank.Value

    rank.Changed:Connect(function()
            bgc.Frame.TextLabel.Text = "Stage: "..rank.Value
    end)

        bgc.Parent = workspace:WaitForChild(char.Name) :WaitForChild("Head")
    end)
end)

0
go with his iRoklas 1 — 6y
0
this broke it? now it doesnt show anymore? GenericTM 2 — 6y
0
This should be the same expect for it updating when the value is changed DevingDev 346 — 6y
0
except| DevingDev 346 — 6y
0
yea but now it doesnt show it over head for some reason GenericTM 2 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

You have to constantly be looking for the value of the rank so try a while true do script. I don't have the time to write one atm but you get the jist. Just do a while true do to refresh the rank value.

0
no? DevingDev 346 — 6y

Answer this question