hey there, basically. i have this script and a stamina bar GUI, the script and stamina works, but when i set the guis size ( players.LocalPlayer.PlayerGui.Stamina.Bar.Size = UDim2.new((current / max) * 0, 298, 0, 50) ) the bar just doesnt seem to work at all.
You’re multiplying the (current / max) by zero (* 0) on line 25 which will always give zero no matter what the current and max variables are set to. Not sure if this is intended or not. It might be worth checking the effects of using scale and offset, and how you might go about calculating this values based on your current and max variables.
You shouldn’t remove it, but simply change the X Scale to something other than (current/max) * 0. I don’t know how your GUI is layed out, but do you might need to replace it with current/max instead.
Hey so, when you create a UI, there is something called the “size offset” which would pretty much change the size of the UI depending on someone’s screen size. I suggest changing this to 0 to keep consistent sizing for all players.
Then, you would have the UI size to be a little smaller with the offset numbers. Then you would input those coordinates, and instead of (current/max) * 0 it would be current/max *(size of the UI)
Also, you might need to split the script into a Client Sided and a Server Sided, to replicate the Stamina Bar as well as the Sprinting of the Player. (server would be the one handling the UI and the stamina bar whereas the client would handle the sprinting on Key Pressed)