ye, you are right. Script in the serverScriptService
hmmm⌠strange. What do I have to do to get it to work? I have the script in ServerScriptService, and the gui is originally in serverStorage.
You can try to re-locate the gui from serverstorage to lighting?
local Lighting = game:GetService("Lighting")
local statUnder = Lighting:WaitForChild("statUnder")
local abbreviations = {
"",
"K",
"M",
"B",
"T"
}
local function abbreviateNumbers(Number)
for i = 1, #abbreviations do
if Number < 10 ^ (i * 3) then
if abbreviations[i] == "â" then
return "â"
else
return math.floor(Number / ((10 ^ ((i - 1) * 3)) / 100)) / (100) .. abbreviations[i]
end
elseif tostring(Number) == "Inf" then
return "â"
end
end
end
local RebirthValues = {
[0] = "đ¤Noob",
[1] = "đBeginner",
[2] = "đRookie",
-- ... complete the list
}
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local leaderstats = player:WaitForChild("leaderstats")
local Power = leaderstats:WaitForChild("Power")
local Mass = leaderstats:WaitForChild("Mass")
local Rebirth = leaderstats:WaitForChild("Rebirth")
local Head = character:WaitForChild("Head")
local uiClone = statUnder:Clone()
uiClone.Name = "StatUnderClone"
uiClone.Parent = Head
local uiClone2 = Lighting:WaitForChild("rebirthUnder"):Clone()
uiClone2.Name = "RebirthUnderClone"
uiClone2.Parent = Head
local function update()
uiClone.stat.Text = abbreviateNumbers(Power.Value + Mass.Value).. " Power"
print("update Power")
end
local function updateRebirth()
uiClone2.stat2.Text = RebirthValues[Rebirth.Value]
end
update()
task.wait(1)
updateRebirth()
Power.Changed:Connect(update())
Mass.Changed:Connect(update())
Rebirth.Changed:Connect(updateRebirth())
character.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end)
end)
How about when you call the functions here:
Do the print statements inside update and updateRebirth print? Or do they not print at all?
I pseudo-tested your code and everything worked fine. catalinprooo, also tested the code and it worked. So, my assumption is as follows:
Youâre likely changing the leaderstat values locally so the server doesnât detect the changes. Make sure that when you change the values in leaderstats, you do it from a server script.
If youâre certain that youâre changing the values from the server, could you show us the function that changes the leaderstat values?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.