01 | local url = "" --webhook link-- |
02 | local http = game:GetService( "HttpService" ) |
03 | local player = game.Players.LocalPlayer |
04 | script.Parent.MouseButton 1 Click:Connect( function (player) |
05 | local data = { |
06 | [ 'embeds' ] = { { |
07 | [ 'title' ] = "Button clicked" , |
08 | [ 'description' ] = player.Name .. " has clicked the button" , |
09 | [ 'url' ] = "https://www.roblox.com/users/" .. player.UserId .. "/profile" |
10 |
11 | } } |
12 | } |
13 |
14 | local finaldata = http:JSONEncode(data) |
15 | http:PostAsync(url, finaldata) |
16 |
17 | end ) |
Edit: My Error
MouseButton1Click cannot get the player as far as I know. Try using a LocalScript, Script, and RemoteEvent, because RemoteEvents automatically pass the player object as the first parameter.
Edit: Because it's in the gui, you could script.Parent.Parent, etc. to get the player's name.