Print not working?

So, basically I am trying to test a remote event, and I added a print() to check if it’s working, but when I tested it, nothing was printed. I was confused so I decided to change the baseplate color when the remote was fired and the color changed! But nothing was being printed. I don’t know why this is not working, and I know its not too big of a problem but I still need to use print() sometimes.
Here are my current scripts

Local Script:

local button = script.Parent
local creator = button.Parent.Creator.Value
local plrNumVal = button.Parent.AmountOfPlayers.Value
local plrChild = button.Parent.Players:GetChildren()
local childrenCount = #plrChild

script.Parent.MouseButton1Click:Connect(function()
	if plrNumVal >= 4 and childrenCount >= 3 then return end
	if button.Parent.Creator.Value == '' then return end
	game.ReplicatedStorage.AskOwner:FireServer(creator, childrenCount, plrNumVal)
end)

Server Script (Placed in workspace)

game.ReplicatedStorage.AskOwner.OnServerEvent:Connect(function()
	game.Workspace.Baseplate.Color = Color3.fromRGB(255, 0, 0)
	game.Workspace.Baseplate.Transparency = 0.7
print("Test")
end)

I don’t see anything in the output so I have no idea what I am doing wrong, and I don’t seem to find any errors in my script.

3 Likes

Are you looking at the Client output console?

I’ve checked the in-game console (F9) and the output console and nothing was being printed.

1 Like

Indent your print statement and run it again.

Maybe the MouseButton1Click isn’t passing your if statements

Try this and see if it outputs anything

script.Parent.MouseButton1Click:Connect(function()
	if plrNumVal >= 4 and childrenCount >= 3 then return warn'1' end
	if button.Parent.Creator.Value == '' then return warn'2' end
	warn'3'
	game.ReplicatedStorage.AskOwner:FireServer(creator, childrenCount, plrNumVal)
end)

Indentation makes virtually no impact on the way code runs. As long as it is written in correct syntax, it will work, no matter the indentation/formatting.

I would recommend checking out the client end code, rather than the server. It seems as though the remote event is never being fired at all.

5 Likes

Oops. I’m thinking of Python, not Lua.

1 Like

Indented it, still no difference. I think this might be a bug because I don’t see any errors on the script

You can debug your script with prints.

local button = script.Parent
local creator = button.Parent.Creator.Value
local plrNumVal = button.Parent.AmountOfPlayers.Value
local plrChild = button.Parent.Players:GetChildren()
local childrenCount = #plrChild

print("Variables Initialized")

script.Parent.MouseButton1Click:Connect(function()
	print("Mouse Clicked")
	if plrNumVal >= 4 and childrenCount >= 3 then return end
	print("Player/Child Count Passed")
	if button.Parent.Creator.Value == '' then return end
	print("Creator Exists")
	game.ReplicatedStorage.AskOwner:FireServer(creator, childrenCount, plrNumVal)
	print("Remote Fired")
end)

Whichever lines are not printed, is most likely where the issue is. If all lines print, it is a server side issue.

1 Like

there no () or am i missing something???

It is correct. Parentheses are generally used to prevent bugs or when you try to mess with more than one argument.

warn "5"

This will work.


warn "5 " .. "5"

But this one won’t work.


warn("5 " .. "5")

But this will work.

When you want to pass the parameters of a function, of course, you should use parentheses.

3 Likes

ima still use them Parentheses they be the better

2 Likes