Hi. I’m trying to make a working elevator for my game, but I don’t know how to move the model using Vector3, since I guess its different from moving a regular part. Here’s my script:
Button = script.Parent
Elevator = game.Workspace.Elevator --The Elevator is the model
Button.ClickDetector.MouseClick:connect(function()
for i = .5,20,.1 do
game.Workspace.Elevator:MoveTo(90,i,50)
end
end)
My error is “Unable to cast double Vector3”. Sorry if I’m missing something obvious, I’m fairly new to scripting.
I believe you can weld models together so that they move together. You should use tween service to move the elevator though.
ex:
local TweenService = game:GetService("TweenService")
local seconds = 5
local elevator = game.Workspace.Elevator.PrimaryPart
local goal = {}
goal.Position = Vector3.new(10, 10, 0)
local tweenInfo = TweenInfo.new(seconds)
local tween = TweenService:Create(elevator, tweenInfo, goal)
tween:Play()
As far as I’m concerned you can’t move a model since all it is a group of a bunch of parts. You can either use a “in pairs” function, move them all one by one, or weld them using a WeldConstraint.
Alright cool. I think it will work though because if I stick all the parts together, and move up one part, all the ones connected to it will move up as well I believe. Thank you for your help.