Mk, you’ve got the color wrong. It needs to be formatted in a certain way. Something like 0x before it. Lemme check out what I have for my script. Please send over the error.
The way you have your code is confusing, if this is in a textbutton there’s 0 need for a playeradded event, and I’m pretty sure webhooks don’t work locally even after you do that change, so you need a remoteevent to fire the webhook after clicking, and you’d also need to format the color correctly from what I have saw otehrs do with their webhook since you’d need to pass in a hex code as the person above me mentioned
What @EmbatTheHybrid is saying is that your code is not well written. You can just fix it with:
local url = "" -- webhook
local http = game:GetService("HttpService")
script.Parent.Parent.Call.MouseButton1Click:Connect(function(plr)
local data = {
["content"] = '',
["embeds"] = {{
["title"] = "Mod Call",
["description"] = plr.Name.." is in need of assistance!",
["color"] = tonumber(0x1d8dde),
}}
}
data = http:JSONEncode(data)
http:PostAsync(url, data)
end)
The thing is, is that clickdetectors always give the player instance. So you don’t need a player added event.
That will still not work as the webhook needs to be posted from the server, and this is not a clickdetect, this is a TextButton/ImageButton and MouseButton1Click does not return anything, and thus will give an attempt to index nil with Name error
We can’t give you final scripts/write them for you, we can only help you figure out your issues and it’s up to you to make the final pieces of scripts. If you don’t know how RemoteEvents work, research on them.
But to give a bit of a boost, you’d have code similar to this
Okay, so I misunderstood, and it seems to be a GUI, Thanks Embat. You need to use a remote event to contact the server to tell them about the webhook and to fire it.
game.ReplicatedStorage.YourRemoteEvent.OnServerEvent:Connect(function(plr)
local data = {
["content"] = '',
["embeds"] = {{
["title"] = "Mod Call",
["description"] = plr.Name.." is in need of assistance!",
["color"] = tonumber(0x1d8dde),
}}
}
data = http:JSONEncode(data)
http:PostAsync(url, data)
end)
end)
No…It’s the code inside of where you originally have your entire code in, the RemoteEvent code is in a regular script that preferably is in ServerScriptService
No, you’re getting the gui object from StarterGui, just put the FireServer code as a loaclscript inside of the button and change the references accordingly