Hello! I’m currently attempting to create a new part, and move that part at a random position, between some extremities.
I’ve created 4 parts in a North, South, East and West formation, took the X or Z position, depending on the part, and created this code:
local Extremities = script.Parent.Extremities local N = Extremities:FindFirstChild("N").Position.Z local S = Extremities:FindFirstChild("S").Position.Z local E = Extremities:FindFirstChild("E").Position.X local V = Extremities:FindFirstChild("V").Position.X while wait(math.random(2,5)) do local Spill = Instance.new("Part") Spill.Parent = game.Workspace Spill.Position = Vector3.new(math.random(E,V),script.Parent.Position.Y,math.random(N,S)) end
(I’ve removed what isn’t necessary, such as details about the part’s colour, size, etc.)
This is the error (Line 24 is where the command usually is put, but everything else in the script works, and it doesn’t interfere with the position values):
I’m judging it’s something wrong with the way I formulated the Vector3.new(), but I can’t seem to figure out exactly what I did wrong.
I’d love some help. Maybe something stupid I skipped over.
Thanks in advance!