How do I fix this percentage script?

I’ve tried many times to figure it out and seem’s to fail, they’ve worked but then end up failing.
My script is something like this.

game.Players.PlayerAdded:Connect(function(Player)
   while wait() do
       local MaxProgress = Player.PlayerGui.Value
       script.Parent.Secondary.Text = math.floor((Player.leaderstats.Progress.Value/MaxProgress.Value) * 100) .."%"
end)

I’ve tried to make it connect to the leaderstat’s and make it change the text everytime the xp is added and change to (number that depends on how much value needed to be complete)% done.

If you need a clear understanding let me know, but I don’t seem to know much about how to get a server script into leaderstats and the playergui along with changing the billboard gui text above the character’s head after it’s been changed.

this script is incomplete

Change it to

game.Players.PlayerAdded:Connect(function(Player)
   while wait() do
       local MaxProgress = Player.PlayerGui.Value
       script.Parent.Secondary.Text = math.floor((Player.leaderstats.Progress.Value/MaxProgress.Value) * 100) .."%"
   end
end)

then let me know of any errors

Hmmmmmmmmmmm gotta wonder why it ran multiple times?

Did you mean to only put the Gui? Also you can use the Changed event for Values to detect when you want something to change

Let me try to see if that was the situation! I will reply soon as I can ^^^

The script there is what detects into the PlayerGui’s storage then locates the value script,
the value script is also the max progression.

Okay so I’ve changed it to what you’ve done but added a few changes such as putting the MaxProgress value into replicated storage, since it won’t locate in PlayerGui anymore, but. I don’t know why it wont update the text itself.

It’s also at the max of 133 for the progression.

Here’s an image.

can i get a screenshot of it before you changed it?

Currently it’s actually been the same for everything sept for the change of the value to replicated storage, sorry if this doesn’t explain much It’s been breaking alot for unknown reason’s, even if I reverted some script’s.

Well did you change the MaxProgress variable to the value in ReplicatedStore? If you didnt be sure to do that also can you possibly check the output for any errors?

I have checked output and made sure the variables were correctly working, it’s somewhat hidden or just the script itself broken.

I don’t have a good plausible answer and, if you need I can show you a gif of the output not reporting anything out of it.

Is it possible for me to get a copy of the game so I can take a look and script it till it works? If not then send me a gif of the output

Of course let me send one right now!
PercentageScript.rbxl (25.9 KB)

Question

	local MaxProgression = Instance.new("NumberValue", Folder2)
	MaxProgression.Name = "MaxProgression"
	MaxProgression.Value = 150

why does the leaderboard script make this value
but the script that changes the text calls

game.ReplicatedStorage.Value

as MaxProgress?

It’s really just for placing it somewhere else soon when I figure it out but it doesn’t really matter.

Edit: I was doing that… anyways I fixed some things and it seems to be working here is the place file

PercentageScript.rbxl (25.9 KB)

that wouldnt change anything as in PEMDAS for MD Mult and Div you do it Left to Right and this is about where you recommended doing the (a/b) * 100

It does change things. take this script as example:

local a = 50
local b = 100
print(math.floor(a/b)*100)
print(math.floor((a/b)*100))

I’ve tried looking into it and seem’s like the text still wont change…
https://gyazo.com/a9dd44706c23528427a16fb7c3a05fb7

wierd as i put this

 math.floor(((Player.leaderstats.Progress.Value/MaxProgress.Value) * 100)) .."%"

yet it didnt work :confused: