I copy/pasted my code from one place into another and changed a few things so it can function properly but for some reason the events won't fire when the game begins. my code is as follows

Server script:

local rs = game:GetService("ReplicatedStorage")
game:GetService('Players').PlayerAdded:Connect(function(player)
		wait(0.1)
		local pet = save.CheckPet(0, player)
		if pet ~= "" then
			rs:FindFirstChild("serverToClient"):FireClient(player, pet, "Pet")  -- doesn't fire?
		end
		wait(0.5)
		local trail = save.CheckEquipped(0, player)
		if trail ~= "" then
			rs:FindFirstChild("serverToClient"):FireClient(player, trail, "Trail") -- doesn't fire?
		end
		table.insert(_G.players, player)
		script.maxWin.Value = table.getn(_G.players)/2
		--check to see if all players
		gameStart()
end)

LocalScript:

function spawnEquip(item, Type)
	print(item, Type)  -- nothing is printed cause it won't fire
	if Type == "Trail" then
		print(item)
		local eqEvent = rs:WaitForChild("equip")
		eqEvent:FireServer(item)
	elseif Type == "Pet" then
		print(item)
		local eqEvent = rs:WaitForChild("equipPet")
		eqEvent:FireServer(item)
	end
end
event.OnClientEvent:Connect(spawnEquip)

This part of the code was left unchanged from my previous game so I have no idea why it's not working. Anyone got any ideas?

3 comments

0

Hello there, are you sure the code inside the Ifs are running?

0

Any errors?

0

You should put prints inside it, that might help