TweenInfo not seeing a number value as a number


im have a script that spawns characters and stuff… i want the model the get tweened afterwards. I use a event for this and also the values are included in the event

script.EnemySpawn.Event:Connect(function(enemyType, startPos, endPos, tweenTime)
	local TI =,Enum.EasingStyle.Cubic,Enum.EasingDirection.InOut,0,false,0)
	local enemy
	if enemyType == "Guitarist" then
		print(enemyType, " Spawned!")
		enemy = enemyFolder.Guitarist:Clone()
		enemy.Parent = workspace.Enemies
		local rotation = enemy:GetPivot().Rotation
		TweenService:Create(enemy.HumanoidRootPart,TI,{Position = endPos}):Play()
	elseif enemyType == "StoneStatue" then...

the script goes one like this howewer i keep getting this error first argument expects a number for time.

the line of code that sends the event is this


can you guys tell me where and what is the problem?

If tweenTime is a NumberValue then you need to retrieve the actual value by indexing .Value.

local TI =,Enum.EasingStyle.Cubic,Enum.EasingDirection.InOut,0,false,0)
1 Like

i get this error intead
Players.Ghostisnothere2098.PlayerGui.enemySpawns:13: attempt to index number with 'Value'

edit: i printed out the tweenTime and i just gets printed out as “3” i dont understand what is wrong here
another edit: it also occasionally gets printed as nil…

Is it because tweenTime is typed as a string? Try doing this:

local TI =,Enum.EasingStyle.Cubic,Enum.EasingDirection.InOut,0,false,0)

Edit: Just saw that you mentioned:

another edit: it also occasionally gets printed as nil…

This may be a much deeper rooted issue related to other parts of your code then, the code provided above is not enough for us to debug it for you. Consider going through the code yourself (Or posting more relevant parts of it, so we can have a better understanding) and refactoring some parts of it.


That’s odd, clearly tweenTime is indeed a number.
For debugging purposes, print every argument from the event and see what they are. Maybe they aren’t always what you expect them to be?

your line of code magically worked…
i have no idea what was the issue, some roblox jank maybe?
also thank you very much ive been trying to solve this for 3 days

1 Like

Glad I could be of assistance :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.