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

How do I set a Cloned Bricks position?

Asked by 4 years ago

I don't know how to do this this is my code, it's a zombie spawner by the way.

local ZS = script.Parent

while true do
    local spawner = game.Lighting.Zombie:Clone(ZS)
    spawner.Parent = game.Workspace
    spawner.Position = ZS.Position == Vector3.new(ZS.Postion.X, ZS.Position.Y + 50, ZS.Position.Z)
    wait(4)
end
1
Can you explain why you put spawner.Position = ZS.Position == Vector3.new() ? because you are setting spawner's position to an if statement condition rower86 35 — 4y

2 answers

Log in to vote
0
Answered by
bum5Br 97
4 years ago
Edited 4 years ago

Just remove the ZS.Position == part and it should work fine

ZS = script.Parent

while true do
    local spawner = game.Lighting.Zombie:Clone(ZS)
    spawner.Parent = game.Workspace
    spawner.Position = Vector3.new(ZS.Postion.X, ZS.Position.Y + 50, ZS.Position.Z)
    wait(4)
end
0
It needs to be there if it isn't its a nil value Brockanthony10 19 — 4y
0
just change ZS to a global value, no need to have local ZS bum5Br 97 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You're doing this:

ZS.Position == Vector3.new(ZS.Position.X, ZS.Position.Y + 50, ZS.Position.Z)

This returns a boolean, not a Vector3. You'll get an error as a result.

The == syntax tells the compiler that what you're giving it is a condition. This means that == will make the statement return a boolean, which will either be true or false. This is not what you're looking for, and telling us that it checks to make sure that it isn't nil is completely stupid.

I think what you mean is this, if I'm not mistaken:

spawner.Position = ZS.Position + Vector3.new(ZS.Position.X, ZS.Position.Y + 50, ZS.Position.Z) -- The plus sign can also be a minus sign if you're subtracting the two Vector3's

Answer this question