Can only tween objects in the workspace error?

I have an error when I run this code:

local geez = Player.PlayerGui:WaitForChild("Price")
local Main = geez.Frame.Main
workspace.Folder.sad.ClickDetector.MouseClick:Connect(function()
		Main:TweenPosition(UDim2.new(.5,0,.5,0),"Out","Quad",.2)
print("test")
end)
--other lines of code

The error is:

Can only tween objects in the workspace error

Any help?

1 Like

you could try,

local Main = geez:WaitForChild("Frame"):WaitForChild("Main")

also, I’m not sure why you have a nested event declaration inside of your .MouseClick event, it might be better to bring it outside of that event scope.

Oh my bad, I was getting rid of other code.

I’m still getting the error with that modification.

add in a

print(Main.Parent)

and see what it prints.

Hello,um guys you know this is 3D right > Vector3

It printed Frame.



<404>

Sorry, I don’t know if this had anything to do with my post. If you need help with scripting please post in #help-and-feedback:scripting-support and wait patiently!

This looks fine to me, are you using a local script?

Yes I did.




I have this LocalScript in the StarterPack