I have a basic tween function, but every time I run it it errors with: "Unable to cast double to TweenInfo". I know that I'm supposed to have a float there, but I need help turning the input into a float.
The function:
function tween1(object,t,property,value) local t = tonumber(t) local goal = {} goal[property] = value local tweenInfo = TweenInfo.new(t) local tween = tweenService:Create(object, t, goal) tween:Play() end
How I call the function:
tween1(bar,0.25,"Size",UDim2.new(health / maxHealth, 0, 1, 0))
I assume this is for a health bar? Gui's have their own tween services you can use much easier, and with 1 line
bar:TweenSize(UDim2.new(health/maxhealth,0,1,0),"Out","Quad",.25,true)
https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenSize https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenSizeAndPosition