Hey guys I need a way to make a model random spawn at a few different select locations when a player touches another model what i have here basically spawns it wherever it is sitting in edit and i want to spawn at a random place that i can change (x,y,z) please help <3

model = script.Parent.Parent--Indicates that the script interacts with the model the button is grouped with.
backup = model:clone()
enabled = true
function regenerate()
	model:remove()
	wait(3)--
	model = backup:clone()
	model.Parent = game.Workspace
	model:makeJoints()
	script.Disabled = true
	script.Parent.BrickColor = BrickColor.new(26)--Black
	wait(3)--Change this number to change the time in between regenerations via the button, in seconds..
	script.Parent.BrickColor = BrickColor.new(104)--Purple
	script.Disabled = false
end
function onHit(hit)
	if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
		regenerate()
	end
end
script.Parent.Touched:connect(onHit)

2 comments

0

Use code block to code your script. It will help the person helping you help you faster.

0

Edited to fix code block formatting.