A few minutes ago, I tried tweening a model’s position by myself, but I failed and my script didn’t work. Can you guys give me an example script on how tweening a model’s position work?
You should tween the PrimaryPart, and make sure everything else is welded to the PrimaryPart.
What part should I set as the PrimaryPart?
It doesn’t necessarily matter, but I recommend you make it have at least a little sense. Like the middle of the model, the most important part to it, or the biggest.
Oh alright. Thank you so much!
Well, I just set a part as the PrimaryPart, and tweened it, but it doesn’t tween the whole model. It tweens the PrimaryPart only, not the model.
Code:
local TS = game:GetService("TweenService")
local part = script.Parent.TriggerPart -- Which is the part I set as a PrimaryPart
local TI = TweenInfo.new(5, Enum.EasingStyle.Linear )
local Goal = {}
Goal.Position = Vector3.new(-99.804, 9.455, 25.395)
local Tween = TS:Create( part, TI, Goal)
Tween:Play()
Did you weld all of the parts to it?
There are just 2 parts in the model ( Part1 and TriggerPart ), but if I weld Part1 to TriggerPart, TriggerPart won’t be in the position I want it to be in
Don’t use welds. Use WeldConstraints. They will stay in the same place, but it will work the same. (they also just work better and are better in general)
After I do this, are you sure the script should work?
Yes. I do it all the time. I promise it does work, and if it doesn’t, please let me know. I will do everything I can to fix it
It works, but the model goes to everywhere, not to the position I set. It goes up, down and everywhere randomly
Can you send a video? I don’t really understand, sorry.
robloxapp-20230815-0337315.wmv (536.6 KB)
(im just testing ambush jumpscare
edit: nvm i have to go to sleep right now. i will check the answer tomorrow
Can you show me the hierarchy and the properties of each WeldConstraint?
Sorry but I actually have to go to bed right now
I’ll send it tomorrow
That is okay, however, I do have school tomorrow. I’ll be able to help after that (around 5:00 PM CDT)
Okay, here are some notes.
I found out why it moves randomly, it is because the model parts weren’t anchored. I anchored them, and the problem was 50% fixed. When I tweened the PrimaryPart, the the whole model didn’t tween. The PrimaryPart is the part that tweened to the set position only, not the model.
Instead of the PrimaryPart, maybe try tweening the model’s CFrame
I’ll try.
[30lettersblahblahbalh]