Is this a Luau Error or not?

This script looks fine too me, heres the script:

repeat task.wait() until game:IsLoaded() task.wait(1)

local function Slider(Seconds)
	local Slide = script.Parent.Parent:WaitForChild("Storage"):WaitForChild("Slide"):Clone()
	Slide:TweenPosition(UDim2.new(-0.119, 0,-0.448, 0),'Out','Sine',0.2)
	task.wait(); wait(Seconds)
	Slide:TweenPosition(UDim2.new(-1.117, 0,-1.454, 0),'In','Sine',0.2)
	task.wait()
	Slide:Destroy()
end

local Buttons = script.Parent.Parent:WaitForChild("Buttons")
local __Replicated = game.ReplicatedStorage:WaitForChild("MenuReplicated")

Buttons.Main.Play.Hitbox.MouseButton1Click:Connect(function()
	Slider(2);
	for _, Dec in pairs(script.Parent.Parent:GetDescendants()) do
		if typeof(Dec) == 'Instance' and Dec:IsA("GuiBase") then
			Dec.Visible = false
			script.Parent.Parent.Enabled = false
			__Replicated.PlayClicked:FireServer()
		end
	end
end)

And heres the error it gives me:

1 Like

You must parent the object to the workspace before tweening.

This is UI. It’s not ment to be tweened in workspace.

1 Like

Then you have to parent the object to the UI.

It’s under a folder which is in the UI, so it should work though?

You are cloning the object without parenting it to an Instance, it’s parent is nil.
Parent the cloned object to an UI if you want it to be tweenable.

Alright, i think I understand now, give me a second to try.

1 Like

It works, I really appreciate it!

1 Like

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