Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is wrong with this movement script?

Asked by 8 years ago

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

Log in to vote
1
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

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.

0
I know the error is in true I am also think I found the answer :3 sammy52520 45 — 8y
0
Just make the 'w' in while lowercase. Pyrondon 2089 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

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

Answer this question