-
What do you want to achieve?
I have a gui element that I want to be able to indicate how many votes are in favor or not in favor of something. -
What is the issue?
I cant figure out how to turn a number of the number of players (max players is 4) into a percent (to put into the indicator frame’s position) -
What solutions have you tried so far?
I tried just dividing as you can see in the print, which I thought worked until I realized the negatives existed and threw it off.
This is my current code:
game.ReplicatedStorage.UpgradePollEvents.SendUpgradeVotes.OnClientEvent:Connect(function(VoteSkew:number)
--[[
Middle = 0.5
Left = 0
Right = 1
MiddleSkew = 0
LeftSkew = -4 (Or whatever the current player count is in the negatives)
RightSkew = 4 (Or whatever the current player count is)
]]
print(VoteSkew/#game.Players:GetPlayers())
script.Parent.BoundingIndicatorFrame.Indicator.Position = UDim2.new(VoteSkew,0,script.Parent.BoundingIndicatorFrame.Indicator.Position.Y.Scale,0)
end)
Basically: How do I turn a negative number into a percent below 0.5? How do I make positive numbers also act simmilar?