Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help with Respawning in a Radius?(Script in question)

Asked by 7 years ago

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)

0
Please put all of your coding in a code-block :-) nanaluk01 247 — 7y

Answer this question