I am trying to make sure that my power-up(Brick) only re spawns in a certain radius but when I do the math.random() for the CFrame values it does it based on the parts CFrame so it can get out of the radius. This is the script I need help on making it respawn in a certain radius.
script.Parent.Touched:connect(function(part) p = script.Parent b = part.Parent:FindFirstChild("Humanoid")
if script.Parent.PowerUpUsed.Value == false then
script.Disabled = true script.Parent.PowerUpUsed.Value = true p.Transparency = 1
end wait(2) x = math.random(-10,10) z = math.random(-10,10)
p.CFrame = p.CFrame * CFrame.new(x,0, z) --print("The X Value is " .. x .. "The X Coordinate is " .. p.Position.X) --print("The Z Value is " .. z .. "The Z Coordinate is " .. p.Position.Z) p.Transparency = 0 script.Parent.PowerUpUsed.Value = false script.Disabled = false
end)