I've got this script:
`function onTouched(m) p = m.Parent:findFirstChild("Humanoid") if p ~= nil then p.Torso.CFrame = CFrame.new(0,-10,13644) --Change the numbers here to the position you want the humanoid to teleport to. end end script.Parent.Touched:connect(onTouched)
I want to make it randomly spawn Players that touch the brick and when they spawn they go to a random spot in a selected area. Any ideas on how to do this?
`
Maybe you could try something like this?
function onTouched(m) p = m.Parent:findFirstChild("Humanoid") if p ~= nil then local x = math.random(-10,10) --Specifies range for what the x coordinate can be local y = math.random(0,10) --Specifies range for what the y coordinate can be local z = math.random(-10,10) --Specifies range for what the z coordinate can be print(x) print(y) print(z) p.Torso.CFrame = CFrame.new(x,y,z) --Change the numbers here to the position you want the humanoid to teleport to. end end script.Parent.Touched:connect(onTouched)