Football regenerating when in the goal

i made this script awhile ago which regenerates a part when this part is touched by a player. is it possible to make two parts and if the ball touches any of those it regenerates?

local model = game.Workspace.b

local message = Instance.new("Message")
      message.Text = ""..model.Name
local backup = model:clone()
local regenerating = false

function regenerate()
	--Don't regenerate again if we're already doing it!
	if regenerating then
		return
	else
		regenerating = true
	end

	model:remove()

	-- Display the regen message for .7 seconds
	message.Parent = nil
	wait(0)
	message.Parent = nil

	-- Put the copied model back into workspace
	model = backup:clone()
	model.Parent = game.Workspace
	model:makeJoints()

	-- After 20 seconds, allow the model to be regenerated again
	wait(20)
	regenerating = false
end

--Connect a function that regenerates the model when a player touches the button
script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		regenerate()
	end
end)

3 Likes

Someone?.. I figure this wouldn’t be too hard would it?

is the thing you want to regenerate a ball?

i want it to regenerate when entering a goal so touching a part

Just put a part where you want it to spawn and proceed to clone to this part cframe

can you edit the script? i dont know how

split your script up.

first part detects when there is a goal.
2nd part activates what you want to be done

something like
if goal touches ball then
-activate goal
-disable other goal.

when people touch the part to reset the ball
– add number to score if goal is active
-reset all goals
– reset ball

sorry to ask but can you script this? im really bad at scripting and normally my scripter does it…

The devforum is for help, not to be babyfed code, Either contact your scripter or learn scripting yourself.

yea i know… but i already gave a code which needs changes

that goes into #help-and-feedback:code-review then.

do you know a place where people can give scripts? i have a scripter but our timezones are different so he comes at night. so in the day i try to do stuff myself so i use devofrum