im making a script that switches poses from a folder in replicatedStorage and a folder in workspace, and changes the value of the room to far, middle or close, you can close a curtain to stop the mosnter from killing you and resetting the script back to the start, but if u fail to you get kicked, but the script isn't working, It doesn't repeat the script once the monster goes back, if anyone could fix it, I would appreciate it,

Script (I updated the script a bit but it still doesn't repeat)

local rep = game:GetService("ReplicatedStorage").Monsters
local cur = script.Parent
local isCurtainOpen = workspace.Curtaians["IsClosed?"]
local place = script.Parent.Banana

game.Players.PlayerAdded:Connect(function(plr)
		place.Value = "Far"
		wait(math.random(35,60))
		place.Value = "Middle"
	cur.Far.Parent = rep
	rep.Middle.Parent = cur
		wait(math.random(35,60))
		place.Value = "Close"
	cur.Middle.Parent = rep
	rep.Close.Parent = cur
	isCurtainOpen.Parent.Hitbox.Tap:Play()
		wait(10)
		if place.Value == "Close" then
	if isCurtainOpen.Value == true then
			rep.Far.Parent = cur
			cur.Close.Parent = rep
			isCurtainOpen.Parent.Hitbox.Tap:Stop()
			place.Value = "Far"
		else
			if place.Value == "Close" then
		wait(10)
		if isCurtainOpen.Value == true then
					rep.Far.Parent = cur
					cur.Close.Parent = rep
					isCurtainOpen.Parent.Hitbox.Tap:Stop()
					place.Value = "Far"
				else
					if place.Value == "Close" then
			wait(10)
			if isCurtainOpen.Value == true then
							rep.Far.Parent = cur
							cur.Close.Parent = rep
							isCurtainOpen.Parent.Hitbox.Tap:Stop()
							place.Value = "Far"
			else
				plr:Kick("You Died")
					end
					end
					end
			end
			
		end
	end
	end)