Script doesn't work but there are no errors?

My code wont work but the output contains no errors. I added a print to mention in the output if its a success or not. Nothing gets thrown in. I’m trying to make a script in a zombie enable so Wave1 can begin.
Code:

local deb = false

script.Parent.Touched:Connect(function(hit)
	local char = hit.Parent
	local root = char:FindFirstChild("HumanoidRootPart")
	
	if not root or deb then return end
	
	deb = true
	local Clone = game.ServerStorage.Maps.GrassIsles:Clone()
	Clone.Parent = workspace
	root.Position = Vector3.new(-483.357, -266.06, 336.087)
	wait(1)
	deb = false
	local Success = false
	game.Workspace:WaitForChild("GrassIsles").Waves.Wave1.Zombie1.Script.Disabled = false
	if game.Workspace:WaitForChild("GrassIsles").Waves.Wave1.Zombie1.Script.Disabled == false then
		Success = true
	else
		Success = false
		print("Fail")
		if Success == false then
			game.Workspace:WaitForChild("GrassIsles").Waves.Wave1.Zombie1.Script.Disabled = false
		end
	end
end)

Please Help!

Can you put a print after this line

And this line

And tell us if both print?

  1. Your setting some script to disabled

  2. If script is disabled, your setting the boolean ‘Success’ to true

  3. The code within the else statement will never run, because your condition is not satisfied. Since the script is disabled, your else statement only continues when the script is not disabled hence doesnt continue.

     If 'x' is disabled then --- true 
          --- run code 
     else
         --- only runs when x is not disabled 
         --- therefore doesnt run because x = not disabled
     end
    
1 Like

Neither of the prints are in the output. I am setting a script to enable when a player hits a part and get teleported. When running the game even after I am teleported I check the script and it shows it to still be disabled so the script clearly didn’t work.

deb is set to false and you checking that it’s true? consider change to
or deb == false

Is this what you mean? if so then yes both printed successfully.

if not root or deb then return end
print("deb success")
deb = true
local Clone = game.ServerStorage.Maps.GrassIsles:Clone()
Clone.Parent = workspace
root.Position = Vector3.new(-483.357, -266.06, 336.087)
wait(1)
deb = false
print("Idk what to put here")

Then can you check if the map clones in workspace? If it does, it must be the positioning. I guess what you want is weld every part of the map to the roop

If I didn’t make the problem clear, the script in the zombie doesn’t enable.