Trying to tween a model

im trying to tween this van model but it keeps coming up w an error:
image

this is the script: tysm


event.OnServerEvent:Connect(function(plr: Player)
	local char = plr.Character
	if char == nil then return end
	--char.Humanoid.WalkSpeed = 0
	--char.Humanoid.JumpHeight = 0
	wait()
	local van = game.ReplicatedStorage:WaitForChild("One Seated Van")
	local vanClone = van:Clone()
	local SpawnOFFSET = CFrame.new(-150,0,-10)
	vanClone.Parent = workspace
	vanClone:PivotTo(char.HumanoidRootPart.CFrame * SpawnOFFSET)
	
	--tween
	local ts = game:GetService("TweenService")
	local tsInfo = TweenInfo.new(
		3,
		Enum.EasingStyle.Cubic,
		Enum.EasingDirection.InOut,
		0,
		false,
		0
	)
	
	local tsNewLocation = Vector3.new(150,0,-10)
	local tweenTrack = ts:Create(vanClone.PrimaryPart, tsInfo ,{CFrame = vanClone.PrimaryPart.CFrame.Position * CFrame.new(150,0,-10)})
	tweenTrack:Play()
end)

You’re getting the error because your tsNewLocation variable is a Vector3, when it should be a CFrame.

1 Like

edit:

mb i actually got it. tysm for ur help boppa, have a great day :smile: ! i had:

{CFrame = vanClone.PrimaryPart.CFrame.Position * tsNewLocation})

that was wrong

solution:

local event = game.ReplicatedStorage:WaitForChild("SpawnVan")
local button = script.Parent

event.OnServerEvent:Connect(function(plr: Player)
	local char = plr.Character
	if char == nil then return end
	--char.Humanoid.WalkSpeed = 0
	--char.Humanoid.JumpHeight = 0
	wait()
	local van = game.ReplicatedStorage:WaitForChild("One Seated Van")
	local vanClone = van:Clone()
	local SpawnOFFSET = CFrame.new(-150,0,-10)
	vanClone.Parent = workspace
	vanClone:PivotTo(char.HumanoidRootPart.CFrame * SpawnOFFSET)
	
	--tween
	local ts = game:GetService("TweenService")
	local tsInfo = TweenInfo.new(
		3,
		Enum.EasingStyle.Cubic,
		Enum.EasingDirection.InOut,
		0,
		false,
		0
	)
	

	local tsNewLocation = CFrame.new(150,0,-10)
	local tweenTrack = ts:Create(vanClone.PrimaryPart, tsInfo ,{CFrame = vanClone.PrimaryPart.CFrame * tsNewLocation})
	tweenTrack:Play()
end)
1 Like

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