my percentage value doesnt really go to 100% when my hold duration has finished for the proximity prompt. sometimes it would be like 98.975825 or something like that. i heard its something to do with a floating number or something? idk
and 2. for my circular progress bar, im trying to make my left_grad’s (ui gradient) rotation to start rotating when the right_grad has finished done so.
if you guys have any idea id really appreciate some help; thanks a million
local function buttonholdBegan(p)
print("started holding")
startTime = tick()
promptCompleted = false
local function updatePercentageHeld()
local elapsedTime = tick() - startTime
local Progress = math.clamp(elapsedTime / TWEEN_TIME, 0, 1) --0 to 100%
local percentageValue = Progress * 100
local silvercircleL = PP_UI.holder.left.silverCircle
local silvercircleR = PP_UI.holder.right.silverCircle
local left_grad = silvercircleL.UIGradient
local right_grad = silvercircleR.UIGradient
percentage.Value = percentageValue
print("progress: "..Progress)
print("percentageValue: "..percentageValue)
if Progress >= 1 then
percentage.Value = 100
promptCompleted = true
percentage.Value = 0
connection:Disconnect()
end
if Progress >= 0 then
right_grad.Rotation = math.clamp(Progress * 180, 0, 180)
right_grad.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, PP_UI.holder.colorOfmissingPart.Value),
ColorSequenceKeypoint.new(0.5, PP_UI.holder.colorOfmissingPart.Value),
ColorSequenceKeypoint.new(0.501, PP_UI.holder.colorOfProgress.Value),
ColorSequenceKeypoint.new(1, PP_UI.holder.colorOfProgress.Value),
}
right_grad.Transparency = NumberSequence.new(0)
left_grad.Rotation = math.clamp(180 + (Progress * 180), 180, 360)
left_grad.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, PP_UI.holder.colorOfmissingPart.Value),
ColorSequenceKeypoint.new(0.5, PP_UI.holder.colorOfmissingPart.Value),
ColorSequenceKeypoint.new(0.501, PP_UI.holder.colorOfProgress.Value),
ColorSequenceKeypoint.new(1, PP_UI.holder.colorOfProgress.Value),
}
left_grad.Transparency = NumberSequence.new(0)
end
end
connection = rs.RenderStepped:Connect(updatePercentageHeld)
end
pp.PromptButtonHoldBegan:Connect(buttonholdBegan)
for math.floor do you mean for both of these variables or just percentagevalue?
local Progress = math.clamp(elapsedTime / TWEEN_TIME, 0, 1) --0 to 100%
local percentageValue = math.floor(Progress * 100)
so for the second issue, im trying to make my ui like the circle on the bottom left. something like that anyways. it’s just glitching really, it won’t like smoothly rotate.