I’m making a script where when the mouse clicks on the screen and a part is created at that position, and the players character is tweened to its position.
I have also tried just char.PrimaryPart.Position and I have also tried a for loop getting each individual part but it just separately tweens.
How would I make tween the entire character?
Video of the problem:
Code:
local char = player.Character or player.CharacterAdded:Wait()
local tweenInfo = TweenInfo.new(
2,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0)
local goals = {
Position = part.Position
}
local goTopart = tweenService:Create(char.PrimaryPart,tweenInfo,goals)
goTopart:Play()
I don’t know if this is a coding error or a studio bug or something else entirely.
Hey! You could maybe use this it could work
for i=1, howManyTimesYouWantToLoop do
task.wait()
print(i)
primaryPart:PivotTo(primaryPart:GetPivot() + Vector3.new(YOUR VALUES HERE))
end
When you tween character.PrimaryPart it tweens only the humanoidRootPart or whatever primaryPart you set make the primaryPart visible and you will see only the primary part moves. Use instead PivotTo() like i showed it’s the same thing as GetPrimaryPartCFrame
You should tween a Vector3Value and bind RenderStepped to teleport your character to the value of the Vector3Value. When completed, just disconnect the RenderStepped connection.
I think your issue has something to do with how Roblox treats .Position and .CFrame changes differently. Let’s say you have Part1 with Part2 weld to it. If you change Part1’s Position, Part2 won’t move. However, if you changed Part1’s CFrame instead, Part2 would get dragged along for the ride. All of that being said, try tweening the character’s PrimaryPart by its CFrame instead of its Position.