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)
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.
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.