Info: this is for a meme game i am making (inferno is an admin) and i was making a command that gives everyone money, but in testing it doesnt work, everything is spelt correctly and works in the in-game console.
local function MoneyStorm()
local allPlayers = game.Players:GetChildren()
for i = 1, #allPlayers do
allPlayers[i].leaderstats.despacitcoin.Value = allPlayers[i].leaderstats.despacitcoin.Value + 500
end
end
local players = game:GetService("Players")
game.Players.PlayerAdded:connect(function(player)
if player.Name == "xInferno_Dragonx" or player.Name == "pokemonzizzle8383" then
player.Chatted:connect(function(msg)
if msg:lower() == "MoneyStorm!" then
MoneyStorm()()
end
end)
end
end)
EDIT: cant tell if this helps but the "despacitcoin" goes up by 20 every 10 seconds on a loop in another script
Edit 2: after the if i put Print("success") however it didnt print, meaning the problem must be before the if statment.
Edit 3: the error seems to be coming from "if msg:lower() == "MoneyStorm!" then" after doing more testing, however i cant seem to locate the problem

4 comments
Why are there two parentheses around your function call? You also declared the Players service, no need to write game.Players, you must also use :Connect(). Lowercase :connect() is deprecated.
the two parentheses were accidental but removing them and re-capitalising did nothing to help
there is multiple if statements so i dont know which one you are talking about, also use the player id not the name.
After if msg:lower()