local part = game.ReplicatedStorage:WaitForChild("ClonedPart")
local Buffer = 5
while wait(Buffer) do
local partClone = part:Clone()
partClone.Parent = workspace
part.CFrame = CFrame.new( math.random(-140,-80),0, math.random(-10, 50))
end
This code spawns a part in the same position every 5 seconds I want to give it a random position in this square
local part = game.ReplicatedStorage:WaitForChild("ClonedPart")
local Buffer = 5
while wait(Buffer) do
local partClone = part:Clone()
partClone.Parent = workspace
part.CFrame.Position = Vector3.new(x, y, z)
end
I apologize, you were right! I think this should work:
local part = game.ReplicatedStorage:WaitForChild("ClonedPart")
local Buffer = 5
while wait(Buffer) do
local partClone = part:Clone()
partClone.Parent = workspace
local randomPosition = Vector3.new(math.random(-140,-80), 0, math.random(-10, 50))
print("Random Position:", randomPosition)
-- Apply random position to the cloned part
partClone.CFrame = CFrame.new(randomPosition)
end