Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make my tween function parse a float instead of a double?

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))

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.