i am trying to dupe a object but it is not working
local bullet = script.Parent.bullet local dupes_of_bullet = bullet.bullets.Value local turret_assaigned = bullet.turret_assaigned.Value local bullet_clone = bullet:Clone() local bullets_existing = bullet.bullets_existing.Value local next_pos = bullet.next_position.Value dupes_of_bullet = math.random(0, 10) if dupes_of_bullet == 0 then warn("did not show bullet cuz dupe count = 0") end if dupes_of_bullet == 1 then bullet.Parent = turret_assaigned end if dupes_of_bullet >= 2 then repeat next_pos = next_pos - 1 bullets_existing = bullets_existing + 1 bullet_clone.Parent = turret_assaigned bullet_clone.Position = next_pos until bullets_existing == dupes_of_bullet end
p.s the object i want to dupe is in server script storage
You can't subtract a number from a non-number value.
If you want to decrease a value from a Vector3 value, there are two ways that I would suggest:
Option 1:
local Result = next_pos - Vector3.new(1,0,0)
That will subtract 1 from next_pos's X value.
Option 2:
local Result = Vector3.new(next_pos.X - 1, next_pos.Y, next_pos.Z)
That will also subtract 1 from next_pos's X value.
If you want to subtract from next_pos's Y or Z value, you would adjust the code accordingly.