Hello everyone!
So i recently got help with a player logging script to discord, but i’ve got a problem.
In ROBLOX STUDIO the script works fine. I use /SaveStats and it sends a message to discord with all players ingame. But when i try it through ROBLOX PLAYER, the command doesn’t work. This is the script which is in ServerScriptService:
local WebHook = "https://discord.com/api/webhooks/" -- Webhook private
local HttpService = game:GetService("HttpService")
local Command = "/SaveStats"
local function SetPlayersActivity()
for i, Players in pairs(game.Players:GetChildren()) do
if Players:IsA("Player") then
local Time = os.time()
local Data = {["content"] = Players.Name .. " Player activity manually change at: " .. os.time()}
Data = HttpService:JSONEncode(Data)
HttpService:PostAsync(WebHook, Data) -- Post
end
end
end
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if string.find(Message, Command) then
SetPlayersActivity()
end
end)
end)
I’ve searched everywhere, but without success.
Anyone could help?