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

How do I set a Cloned Bricks position?

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 comment

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

2 answers

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

2 comments

0

It needs to be there if it isn't its a nil value

0

just change ZS to a global value, no need to have local ZS

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

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