Remote event not working

it works when i test it regularly, but if i try team test, it just does not work

--server
receiveCookie:FireClient(player, randomPlace.Name, "Square")
--client
receiveCookie.OnClientEvent:Connect(newCookie)


here’s the video of it working, but however when i team test it does not work

1 Like

here’s the video unedited

1 Like

Maybe include the second parameter as well inside the client?

1 Like
--client
receiveCookie.OnClientEvent:Connect(newCookie)

: not .

--client
receiveCookie:OnClientEvent:Connect(newCookie)

That’s not correct. It’s a . because it’s an event.

May we see the rest of the server script?

And @MONSTERGAMES3609, @BandQueenForever is correct. Colons define a method, however OnClientEvent is, well, an event, and not a method.

1 Like

yea I realized that later lol 3

--server 
player.Character.Humanoid.MoveToFinished:Connect(function()
	warn("FIREEE") -- this actually prints
	randomPlace.Seat:Sit(player.Character.Humanoid)
	receiveCookie:FireClient(player, randomPlace.Name, "Square") --but this doesnt fire
	print('cutting cookie')
end)
--client 
local function newCookie(randomNum, cookieType)
warn("recieved")
end

image
it does print this in the output for team test

this is the output if i rest it regularly
image
but it doesn’t print if i do team test

Now, would you mind telling me what did you declare “player” as?

player? what do you mean declare it as?

what’s player here? is this inside another function as a parameter, or how did you declare this?
declaration as

local whatever = 2340879

ohh I got the player from a touched event

shape.Touched:Connect(function(hit)
	local player = Players:GetPlayerFromCharacter(hit.Parent)
end)

This is the squid game cookie game as I’m obviously aware. So, assuming the shape.Touched event fires, you wait until the MoveToFinished event, right? I don’t see anything wrong here, can I take a look at the full function?

yeah sure

local function moveLine(shape)
	local line = shapes[shape]
	local endShape = EndLine[shape]
	print('moving line')
	for _, player in pairs(line) do
		player.Character.Humanoid:MoveTo(Vector3.new(endShape.Position.X,endShape.Position.Y,endShape.Position.Z - ((#shapes[shape] -1 )* spacing) ))
	end
end

for _, shape in pairs(StartLine:GetChildren()) do
	if shape:IsA("BasePart") then
		shape.Touched:Connect(function(hit)
			local player = Players:GetPlayerFromCharacter(hit.Parent)
			if player then
				if table.find(shapes[shape.Name],player) or table.find(cutters,player) or table.find(walking, player) then return end
				local endShape = EndLine[shape.Name]
				table.insert(walking, player)
				controlEvent:FireClient(player, false)
				player.Character.Humanoid:MoveTo(Vector3.new(endShape.Position.X,endShape.Position.Y,endShape.Position.Z - (#shapes[shape.Name] * spacing) ))
				local move_connect
				move_connect = player.Character.Humanoid.MoveToFinished:Connect(function()
					move_connect:Disconnect()
					table.insert(shapes[shape.Name],player)
					walking[player] = nil
				end)
			end
		end)
	end
end

local checkLine
checkLine = RunService.Heartbeat:Connect(function()
	for shape, cool in pairs(shapeCoolDown) do
		if #shapes[shape] > 0 then
			if cool < time() then
				shapeCoolDown[shape] = time() + cooldownTime
				local player = shapes[shape][1]
				table.insert(cutters, player)
				--table.remove(shapes[shape], 1)
				shapes[shape][1] = nil
				moveLine(shape)
				local randomNumber = math.random(1, #container)
				local randomPlace = container[randomNumber]
				--table.remove(container, randomNumber)
				container[randomNumber] = nil
				print(randomPlace)
				task.wait(1) -- geting cookie
				warn('start')
				player.Character.Humanoid:MoveTo(randomPlace.Seat.Position)
				player.Character.Humanoid.MoveToFinished:Connect(function()
					warn("FIREEE")
					randomPlace.Seat:Sit(player.Character.Humanoid)
					receiveCookie:FireClient(player, randomPlace.Name, "Square")
					print('cutting cookie')
				end)
			end
		end
	end
end)

its the same code, but im just testing it in team test or the regular test
i can’t quite tell if its the server (thats not firing the event) or the client (thats not receiving the event)

sorry if the code is confusing to read, i didn’t add comments

ok strange solution but all i did was just moved the code outside if the gui and it works
image

image

i dont know how to explain how it works but it does