Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Keeps SAYING Disconnected Event? (UNSOLVED)

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)]]--

2 comments

0

Can you please tell the whole error message?

0

It says, "Disconnected event cause of exception".

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.