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

What is wrong with this movement script?

I am using a movement script that controls where a part moves to. I was trying to replicate an example but this is what I got.

local model = script.Parent
local Moving = model.Moving
local Stay = model.stay
local Seat = Seat
local BodyPosition = Moving.BodyPosition

While true do
	BodyPosition.position = Stay.Position
	Wait(6)
	BodyPosition.position = Seat.Position
	wait(6)
	
end

Thank you. The error is found in the keyword true. I was wondering if it was outdated or I did something wrong. I also don't plan on using the loop but for practice I am doing loops and movement so if you guys could help it would be amazing.

2 answers

Your error isn't from the word 'true' -- The output probably said something along the lines of '= expected near true', as it expects 'While' to be a variable. This is because 'While' should be lowercase:

local model = script.Parent
local Moving = model.Moving
local Stay = model.stay
local Seat = Seat
local BodyPosition = Moving.BodyPosition

while true do -- The error
    BodyPosition.position = Stay.Position
    Wait(6)
    BodyPosition.position = Seat.Position
    wait(6)

end

Hope this helped.

2 comments

0

I know the error is in true I am also think I found the answer :3

0

Just make the 'w' in while lowercase.

Here is the more updated script it doesn't have any Syntax errors however it doesn't want to do anything

local model = script.Parent
local Moving = model.Moving
local Stay = model.Stay
local Seat = game.workspace.Seat
local BodyPosition = Moving.BodyPosition

while true do
	BodyPosition.position = Stay.position
	wait(6)
	BodyPosition.position = Seat.position
	wait(6)
end

Also here is the Output

Hello world!
20:52:28.508 - position is not a valid member of Part
20:52:28.509 - Script 'Workspace. MovingTest.Script', Line 8
20:52:28.510 - Stack End
Hello world!
Loaded gloo library. Type _G.gloo.Help() for help.
Ro-Defender has removed a total of 2797 viruses and junk items from your games!
MML Admin Compromised: Running in studio
MML's Admin: Attempting to establish owner's name #1
20:52:34.993 - TestService: Executed MML's Admin Plugin #1 : Message and Hint V2 by MakerModelLua
MakerModelLua's Admin Plugin Loaded!
MakerModelLua's Admin Commands V3.171 Loaded
Executed ClientLog on Player

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