How can I make this run multiple times??? It only runs one time then it says in the output, "Disconnected event cause of exception".
debounce=false function onTouched(hit) local humanoid=hit.Parent:FindFirstChild("Humanoid") local cake=hit.Parent.Name local player=game.Players[cake] local deadv=player:WaitForChild("Dead")--FindFirstChild("Dead") --if not debounce then -- debounce=true --if humanoid then if (debounce==false) then --if (hit.Parent.PrimaryPart=="Head") then --if (hit.Parent:FindFirstChild("ZAnimate")) then return-- debounce=false if (debounce==false) then if (humanoid ~= nil) then if (deadv.Value==true) then if (player.TeamColor==game.Teams.Zombies.TeamColor) then debounce=true local zom=game.Lighting.Zombies[player.Class.Value].ZAnimate:Clone() zom.Parent=humanoid.Parent zom.Disabled=false --hit.Parent:FindFirstChild("RobloxTeam"):remove() hit.Parent:FindFirstChild("Sound"):remove() hit.Parent:FindFirstChild("Animate"):remove() debounce=false end end end end end --script.Parent.Touched:connect(onTouched) --[[ function Start(hit) local h = hit.Parent:findFirstChild("Humanoid") if h ~= nil then print("Ok Started!")]]-- script.Parent.Touched:connect(onTouched) --[[ end end script.Parent.Touched:connect(Start)]]--
Hmm, I am not sure where the error might be. Something that I would do is call the print() function in-between each line to see where the script stops running. I've used this method several times and it has proved to be successful. Hope this helps.