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

How can I make a random spawning Brick if a player touches?

Asked by 5 years ago

Hi guys!

I have a question about a crazy script. lol

So... How can I make a script, if Player touches the brick, the brick disappear, and spawns in a randomly spot in the map. I want to make delay, if the player touches the brick, the brick is disappear and wait(5), and the brick spawns in a random spot in the map.

1 answer

Log in to vote
0
Answered by
3132750 45
5 years ago

I'm feeling nice, I will write the code for you, even though I'm not supposed to.

script.Parent.Touched:Connect(function(prt)
    wait(5)
    if prt.Parent:FindFirstChild("Humanoid") then  -- makes sure a player has touched
    script.Parent.Position = Vector3.new(math.random(0,300) ,0.5,math.random(0,300)) 
    -- 0.5 is the Y value so it stays on the ground, everything else is a random value within baseplate(You should adjusted it to your needs)
end
end)
0
A really big thanks to you! :) Mrattilla -7 — 5y
Ad

Answer this question