Expected string, got object using TweenService

Hello!

I’m new to using CFrame, Vector3, TweenService etc… and I’m trying to get into it. I was following this tutorial, as well as this one to get into it, however I came across an issue, it’s expecting a string instead of the object for argument #2.

This is the line that’s giving the error:

 local tween = ts:Create(h.Parent[torso], TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {Position = Vector3.new(script.Parent.Parent.Destination.Position)})

I put the TweenService into the ts variable.

This is the output error:
12:49:36.956 - Workspace.Model.Part.Script:29: bad argument #2 (string expected, got Object)

Any help, as well as ways to avoid this happening again are welcome.
Thanks in advance!

I think you need to put torso in quotes, like this: h.Parent["torso"]

1 Like

torso is a variable, I’ll add what assigns it here:

		if humanoid.RigType == "R6" then
			torso = h.Parent.Torso
		else
			torso = h.Parent.UpperTorso
		end

In that case you would need to put torso.Name, rather than just torso

1 Like

Yeah, I just realized and facepalmed. Thanks for the help!

1 Like