When this code runs, I get the error “Can only tween objects in the workspace”.
game.ReplicatedStorage.Events.HatchEgg.OnClientEvent:Connect(function(pet, refund)
local frame = script.Parent.HatchFrame:Clone()
if refund ~= 0 then
frame.Label.Text = "You were successfully given the pet."
else
frame.Label.Text = "Item already pet; refunded " .. refund .. "."
end
frame.Title.Text = "You hatched a " .. pet .. "!"
frame.Position = UDim2.new(0,0,1,0)
frame.Visible = true
frame:TweenPosition(UDim2.new(0,0,0,0))
wait(2)
frame:TweenPosition(UDim2.new(0,0,1,0))
wait(2)
frame:Destroy()
end)
This is from a local script inside a screengui.
I am trying to preform the tween on a frame.