So I know this is basic but I’ve never done this before so for me it’s not that basic anyway I want to make a while true do a script that makes a block change positions.
I made a script that changes it but it’s not really working.
If you cant fix the script then if you have an idea to make it work please help.
local one = game.workspace.MaponePos
local two = game.workspace.MaptwoPos
local block = game.workspace.Block
while true do
wait(5)
block.Position = game.workspace.one.Position
wait(5)
block.Position = game.workspace.two.Position
end
Are “MaponePos” and “MaptwoPos” Models or parts? If they are parts then it should work, but if they are models then you should specify which part of the model that the part should teleport to.
local one = workspace.MaponePos
local two = workspace.MaptwoPos
local block = workspace.Block
while true do
wait(5)
block.Position = one.Position
wait(5)
block.Position = two.Position
end
The two examples you gave mean the exact same thing. It’s just that the first example doesn’t work for names with spaces/special characters. Either way works just fine.
Also I tested my own code I realized workspace should be Workspace and works just fine. After that change the code works
local one = game.Workspace.MaponePos
block.Position = game.Workspace.one.Position
would be equivalent to game.Workspace.game.Workspace.MaponePos.Position
What I believe @thetacah meant was that game.Workspace.one.Position is wrong because it is trying to reference an instance named ‘one’ that may not exist, not because it is referencing the Workspace twice.
Woops, I realized I replied to the wrong user. However, the code can be as simple as this :
local Play = true -- // Play The Loop.
local Part1 = workspace.MaponePos -- // Directory of the first part to move to.
local Part2 = workspace.MaptwoPos -- // Directory of the second part to move to.
local MainBlock = workspace.Block -- // Directory of the main part to move.
local Delay = 5 -- // How long to wait in-between changing the position of the MainBlock.
while Play do -- // Loop.
wait(Delay) -- // Wait.
MainBlock.Position = Part1.Position -- // Go To Part1's Position.
wait(Delay) -- // Wait.
MainBlock.Position = Part2.Position -- // Go To Part2's Position.
end -- // End the loop.
This was mostly said by @lcgecko moments ago, but I tried making it a bit easier to understand / read. Was this all of your concern?