Why does the script just stop for no reason? module script with RemoteEvent:Fireclient()

There are no thrown errors, it just stops for no reason.

I need an answer pls

local module = {}

local kicked = {

}

function module.EntityInfo()
	return EntityInfomation
end

function module.ServerBan(human:Humanoid,name)
	local plr = game:GetService("Players"):GetPlayerFromCharacter(human.Parent)	
	if workspace.RoomGenerator.KickOnDeath.Value == true then
		table.insert(kicked,plr.UserId)
		local ban = Instance.new("IntValue")
		ban.Value = plr.UserId
		ban.Parent = workspace.ServerBanList.Players
		ban.Name = tostring(ban.Value)
		local banmessage = Instance.new("SoundGroup")
		banmessage.Name = "You died to the entity known as '"..name.."' in ths server."
		banmessage.Parent = ban
		game.Debris:AddItem(plr,100)
	end

	if EntityInfomation[name]["jumpscare"] == true then
		game.ReplicatedStorage.Jumpscare:FireClient(plr,name)
	end
	if workspace.RoomGenerator.KickOnDeath.Value == true then
		wait(5)
		local theplayer = plr
		local function showtext(text,waitt)
			print("Showing text "..text.." to "..theplayer.Name.. " for "..tostring(waitt))
			game.ReplicatedStorage.DeathText:FireClient(theplayer,text)
			wait(waitt)
		end
		if name == "Chase" or name == "MemoryChase" then
			showtext("You died to Chase.",3)
			showtext("Chase is a pretty simple entity.",4)
			showtext("He makes the lights flicker red for a moment when he spawns.",5)
			showtext("Get into a hiding place before he can kill you!",4)
	end
		game.ReplicatedStorage.Hide:FireClient(plr)
		wait(2)
		game.Debris:AddItem(plr,7)
		game["Teleport Service"]:Teleport(12453066919,plr)
	end
end

function module.ServerBanHazard(human:Humanoid,name)
	local plr = game:GetService("Players"):GetPlayerFromCharacter(human.Parent)	
	if workspace.RoomGenerator.KickOnDeath.Value == true then
		local ban = Instance.new("IntValue")
		ban.Value = plr.UserId
		ban.Parent = workspace.ServerBanList.Players
		ban.Name = tostring(ban.Value)
		local banmessage = Instance.new("SoundGroup")
		banmessage.Name = "You died to the hazard '"..name.."' in ths server."
		banmessage.Parent = ban
		game.Debris:AddItem(plr,100)
	end
	if workspace.RoomGenerator.KickOnDeath.Value == true then
		wait(5)
		local theplayer = plr
		local function showtext(text,waitt)
			print("Showing text "..text.." to "..theplayer.Name.. " for "..tostring(waitt))
			game.ReplicatedStorage.DeathText:FireClient(theplayer,text)
			wait(waitt)
		end
		if name == "Scared" then
			showtext("You burnt to death inside a Shield.",3)
			showtext("Shields run pretty hot, it's unsafe to stay inside one for too long.",6)
			showtext("Only hide when you need to!",3)
			end

		game.ReplicatedStorage.Hide:FireClient(plr)
		wait(2)
		game.Debris:AddItem(plr,7)
		game["Teleport Service"]:Teleport(12453066919,plr)
	end
end


return module

this is part of a complete rework of spaghetti code btw

1 Like

I see you are a bit frustrated, due to your use of language. I will do the best I can. Do you know where it stops? Try adding some prints.

sorry about that, but it stops right here

showtext("He makes the lights flicker red for a moment when he spawns.",5)
--just stops here
showtext("Get into a hiding place before he can kill you!",4)

the script doesnt get disabled, it runs again when I call it again, but it stops at this exact point, for some reason.

there are no thrown errors

Weird… I can’t figure it out. Instead of passing the wait parameter to the function, try waiting outside of the function.

If that doesn’t work, use task.delay, It runs asynchronously so you’ll have to add up all the wait values.

Hold up… if you require a module, then the script gets deleted, does it cancel the module?

(Nahh i put 3 typos?? How)

No. The module just returns a table object, it won’t go anywhere.

Was this actually the solution? It’s not good practice to mark something as a solution if it didn’t actually fix the problem, as people are significantly less likely to actually pop in and continue helping, and as a result the topic will close after 2 weeks.

It turned out that the script that required the module was getting deleted, which was making it not work. By making the script not get deleted I was able to solve the problem

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.