Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Attempted to Concatenate Instance with String?

Asked by 3 years ago
Edited 3 years ago

I'm making a chat logging script for my game. It just sends all the chat messages to a discord webhook. I know how to combine strings and instances, I use it a lot. But for some reason It's not working here.

Here's my script:

local http = game:GetService("HttpService")
local webhookUrl = "[webhook link]"


game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(msg, r)
        if r then
            local data = {
                -- too lazy to add this rn will do later
            }
            data = http:JSONEncode(data)
            http:PostAsync(webhookUrl, data)
        else
            local data = {
                -- */* The error is here: *\* --
                ["content"] = "**"..player.."** said "..msg.."."
            }
            data = http:JSONEncode(data)
            http:PostAsync(webhookUrl, data)
        end
    end)
end)
0
Slap me pls, because i don't answer XDD maybe tomorrow Ferrarimami 120 — 3y
0
Get /slap'd Recrucity 13 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Nevermind! Small mistake :) I had to change it to player.Name lol :)

Ad

Answer this question