If I wanted to move a model of bricks with velocity = Veclocity3.new(0,0,5)
Would that work if I set
ding = game.Workspace.747
then said
ding.Velocity = Velocity3.new(0,0,5)
Is moving a model with velocity possible like this?
If I wanted to move a model of bricks with velocity = Veclocity3.new(0,0,5)
Would that work if I set
ding = game.Workspace.747
then said
ding.Velocity = Velocity3.new(0,0,5)
Is moving a model with velocity possible like this?
With Velocity? I'm a bit puzzled. What I believe you're going for, is Vector3. Vector3 is their position, X, Y, Z. That's how you would 'move' a model of bricks. Nice attempt, but it's not a straight forward property. You'd need to loop through all of the properties. And even so, you can't set a direct position for it (That I know of). You'd need to change its position by increments. Example:
local ding = game.Workspace["747"]
for _,v in pairs(ding:GetChildren()) do
if v:IsA("BasePart") then -- Check if it's a part
v.Position = Vector3.new(v.Position.X, v.Position.Y, v.Position.Z + 5)
end
end
Alright, so you need a more detailed explanation! So, on line 3, I used a generic for loop. Basically, it goes through every part in the model 'ding'(child), and executes the written code. On line 5, I just increased it's position. If you only put straight number values like Vector3.new(0,0,0) The model won't be in it's original state. It'll be all cluttered up.
Hope I helped! If you have any questions, be sure to comment!
Vector3 is what I meant, it's early morning here. Anyways, I'm not sure what you mean by the function there. Could you explain it?
If you were going for a Vector3, I would say that Shawnyg's function is a bit complicated...
What I would do is:
thing = Workspace.Model --Insert your model here
thing:MoveTo(0,0,0) -- Insert vector3 here
Roblox has a function of models called MoveTo(). This function takes a model, and moves its primary part, and takes the rest of the model with it. The primary part can be assigned in the models properties. Without a primary part this will not work, so select a primary part for your model.
A tip if you are new, is to add a big transparent noncollidable part covering the whole model and selecting it as the primary part, allowing you to move the model as if it was a normal part
Thanks for this!!! Will it just teleport it, or will it move it slowly? It will be AI aircraft for an airport, and I want it to slowly pushback from the gate and such. Would this work for that?
This function teleports it, but if you would like to make it move smoothly, you would need to do it more complicated. A way of making it go straight forward would be: thing:MoveTo(Vector3.new(thing.PrimaryPart.X,thing.PrimaryPart.Y,thing.PrimaryPart.Z + 0.1)), and yes: I forgot the Vector3 in the answer
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Just updated my answer with an explanation