My fire server is not working, which means the changeCPColor function is never being run. All print statements are printing except for "debugging sucks". Here is my code:

Code for server script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
 
--EVENTS:
local remoteEvent = ReplicatedStorage.Events:WaitForChild("secondPassed")

local redTeamCapturedMainCP = ReplicatedStorage.Events:WaitForChild("R-MainCP")
local blueTeamCapturedMainCP = ReplicatedStorage.Events:WaitForChild("B-MainCP")
--------------------------------------------------------------------------------------


local redTeamCP = {0,0,0,0,0}
local blueTeamCP = {0,0,0,0,0}

local redTeamScore = 0
local blueTeamScore = 0

gameIsRunning = true
while gameIsRunning do
	remoteEvent:FireAllClients(redTeamScore,blueTeamScore)
	redTeamScore = redTeamScore + 1
	blueTeamScore = blueTeamScore + 1
	wait(1)
end

local function changeCPColor(player, part, color)
	print("Debugging sucks")
	part.BrickColor = color
end

redTeamCapturedMainCP.OnServerEvent:Connect(changeCPColor)

Code for client script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

--EVENTS:
local redTeamCapturedMainCP = ReplicatedStorage.Events:WaitForChild("R-MainCP")
local blueTeamCapturedMainCP = ReplicatedStorage.Events:WaitForChild("B-MainCP")
--------------------------------------------------------------------------------------

player = game.Players.LocalPlayer

print(player.TeamColor)

game.Workspace.capturePointMain.Touched:Connect(function(entity)
	if entity.Parent.Name == player.Name then
		if player.TeamColor.Name == "Really red" then
			print("Red Team has captured Main CP")
			redTeamCapturedMainCP:FireServer(game.Workspace.capturePointMain,BrickColor.new("Really red"))
		end
		else if player.TeamColor.Name == "Really blue" then
			print("Blue Team has captured Main CP")
		end
	
	end
end)se if player.TeamColor.Name == "Really blue" then
			print("will be implemented later")
		end
	
	end
end)

6 comments

0

first of all the player is the first a param the changeCPColor receives and what print statements print???

0

wgars the output

0

they all print except for "debugging sucks"

0

print("Red Team has captured Main CP") this one prints right ?

0

redTeamCapturedMainCP this is an remote event right not a remote function

0

Yes, “red team has captured main CP” works. It is a remote event.