Hmm, mind showing me how you set it up though?.. Preferably a screen shot.
If your code looks like the code in my first post it should work.
I tested it with three parts in the workspace. Make sure you aren’t trying to move models.
I agree that it is the same, but that wasn’t the issue I was referring to. In your first post on this thread it looks like you were saying that something like:
local x = workspace.a.b.c
local y = workspace.x
is the same as:
local y = workspace.workspace.a.b.c
But obviously it isn’t. In the statement y = workspace.x
, the ‘x’ is not substituted with ‘a.b.c’. It is just treated like y = workspace["x"]
which means it would be referencing something named ‘x’, not the object referenced by ‘a.b.c’
That was most likely a typo that they forgot to check back on.
its long but sure why not give me one sec
PICTURE:
Is this a local script or a server script? If you are running a game instead of playtesting, local scripts don’t run. If those things don’t work, use Vector3
instead:
local block = game.workspace.Block
while true do
wait(5)
block.Position = Vector3.new() -- One position here
wait(5)
block.Position = Vector3.new() -- Two position here
end
But the true error of your code is on how you indexed the code:
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 -- This means game.workspace.game.workspace.MaponePos.Position
wait(5)
block.Position = game.workspace.two.Position
end
To fix that do this:
local one = game.workspace.MaponePos
local two = game.workspace.MaptwoPos
local block = game.workspace.Block
while true do
wait(5)
block.Position = one.Position
wait(5)
block.Position = two.Position
end
I am using this code that someone said it works with it but its not working
local Play = true – // Play The Loop.
local Part1 = workspace.GameOne – // Directory of the first part to move to.
local Part2 = workspace.GameTwo – // Directory of the second part to move to.
local MainBlock = workspace.Game – // 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.
What type of script is this?.. A local or a normal?..
We all seem to be over-complicating things here. @lcgecko had the correct solution in reply #6. Unless your object hierarchy is wrong, your only problem was the two typos where you were setting the block’s position.
Hmm, alright. Are there any errors though?..
Ohhh I get what you guys meant. Sorry for the confusion. You are correct.
Local y = workspace.x
Would look for “x” in the workspace.
Edit: lol @VegetationBush just made the same mistake. Also kinda repeating stuff thats been already said…
Hmm, alright. Mind showing me how the parts are laid out?
Either you code doesn’t look like mine or you have other problems outside of that script.
The working code that I have tested
local one = workspace.GameOne
local two = workspace.GameTwo
local block = workspace.Block
while true do
wait(5)
block.Position = one.Position
wait(5)
block.Position = two.Position
end
Let’s try changing the CFrame instead.
local Play = true -- // Play The Loop.
local Part1 = workspace.GameOne -- // Directory of the first part to move to.
local Part2 = workspace.GameTwo -- // Directory of the second part to move to.
local MainBlock = workspace.Game -- // 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.CFrame = Part1.CFrame -- // Go To Part1's Position.
wait(Delay) -- // Wait.
MainBlock.CFrame = Part2.CFrame -- // Go To Part2's Position.
end -- // End the loop.
Changing the CFrame of a part is basically the same as changing the position although I would probably use CFrame over position just because it’s more universal.
the block moves now its just the player spawn where it originally was
What is the code that moves the player to the spawn?
Then the script that spawns the player is using the old position. Make sure the spawn script gets the parts position after the part has moved
Mhmm, I just figured that it’d be better to just go with CFrame
for this case.
CFrame is good because you can change more than just the position. (Angle, lookVector, …)