Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

1 comment

0

A really big thanks to you! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.