Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I fix my movement script that doesn't seem to be working?

I'm making a script for a game I'm developing with my friend, pic99001, but that isn't the point. I'm making a script that repeats a cycle and makes a Model move. It isn't working though! This is the code I tried:

repeat
	workspace.Plane.SpinEngines.SpinRate.Value = workspace.Plane.SpinEngines.SpinRate.Value+1
	wait(1)
until workspace.Plane.SpinEngines.SpinRate.Value == 10
wait(2)
local part = workspace.Plane.PrimaryPart
local plane = workspace.Plane
repeat
	part.Position = Vector3.new(part.Position.X+2, part.Position.Y, part.Position.Z)
	plane:GetPrimaryPartCFrame()
	wait(0.1)
until part.Position == Vector3.new(-600.5, 30.662, -40.654)

Path: game.Workspace.Plane.MainPart.MovementScript Could somebody help? I would much appreciate it! Thanks so much! -JBennettChief9

Follow the game here: https://web.roblox.com/games/4294341129/Cops-Robbers-Prison-Attack-Under-Construction

1 comment

0

There is a function Model:MoveTo() that will move the Model.PrimaryPart. Hope it solve your problem. https://developer.roblox.com/en-us/api-reference/class/Model

1 answer

There are several ways you can do this. I will use TranslateBy(). This takes the model's position into account and will move the model by the X,Y,Z coordinates in the workspace. Replace line 6 - 12 with:

local part = workspace.Plane.PrimaryPart
local plane = workspace.Plane
repeat
	plane:TranslateBy(Vector3.new(2,0,0))
	wait(0.1)
until part.Position >= Vector3.new(-600.5, 30.662, -40.654)

That should do it! If this works, please remember to accept as answer, and maybe upvote if it was extra special. If it doesn't,please contact me and I will get back to you. See ya!

This discussion is preserved as it was. New answers, comments, and votes are closed.