The tween won’t update to show the change in the value. Is there any way I can get the Tween to show changes happening to the “STWBar.BarVal.Value” while the Tween is playing?
(Player.PlayerGui.STWBar.BarVal is just the path the IntValue, so Player.PlayerGui.STWBar.BarVal.Value is just getting the value of said IntValue.)
Won’t be able to use that. The script that handles the Tweening and the script that changes/modifies the “STWBar.BarVal.Value” are 2 different scripts. Maybe if I used a listener event to tell the script that handles the Tweening when the script that changes/modifies the “STWBar.BarVal.Value” has changed the value.
yep, i tried it, playing another tween will override the current tween.
local TSTween = TweenService:Create(Player.PlayerGui.STWBar.BarVal, TweenInfo.new(Player.PlayerGui.STWBar.BarVal.Value/100), {Value = 0})
TSTween:Play()
wait(5)
-- Redefine the TSTween so it will tween to the newest values
TSTween = TweenService:Create(Player.PlayerGui.STWBar.BarVal, TweenInfo.new(Player.PlayerGui.STWBar.BarVal.Value/100), {Value = 0})
TSTween:Play()
or another alternative
-- create a new object and destroys the old one
local newObject = Player.PlayerGui.STWBar.BarVal:Clone()
newObject.Parent = Player.PlayerGui.STWBar
newObject.Value = Player.PlayerGui.STWBar.BarVal.Value
Player.PlayerGui.STWBar.BarVal:Destroy()
local TSTween = TweenService:Create(Player.PlayerGui.STWBar.BarVal, TweenInfo.new(Player.PlayerGui.STWBar.BarVal.Value/100), {Value = 0})
TSTween:Play()
local TSTween
while true do
TSTween = TweenService:Create(Player.PlayerGui.STWBar.BarVal, TweenInfo.new(Player.PlayerGui.STWBar.BarVal.Value/100), {Value = 0})
TSTween:Play()
wait()
end
or
while true do
Player.PlayerGui.STWBar.BarVal.Value -= 1
wait()
end
This has the same issue as eyrtuiop232’s post. If you tween too much, it shortens the time of the tween. I’ll provide a video of this in a second to show you.
No, the time of the tween depends on the amount of “bar” there is. The bar can reach up to a thousand, so when you see “Player.PlayerGui.STWBar.BarVal.Value/100”, its turning the bar into “seconds”. For example, if the bar is 500, it’ll do 500/100, making it tween the bar to 0 in 5 seconds.
Found the “fix” on my own. Not really a fix just a workaround. Changed how the bar values are modified, so you have to fire an event to change the amount. The script that handles the tweening listens for when the event is fire, and if it ever fires during the tween duration, the tween cancels and restarts. This allows for the values to change mid tween without shorterning tween time.