Ok so I used to script but I lost all of my skill, I’ve returned and I’m having an error in my Discord Webhook. I keep getting "attempt to index nil with ‘Name’, here’s my code. (Normal Script)
local url = ""
local http = game:GetService("HttpService")
local Player = game.Players.LocalPlayer
game.Players.PlayerAdded:Connect(function()
local data ={
['embeds'] = {{
['title'] = "New Member!",
['description'] = Player.Name, "is our new member! Congrats 🥳"
}}
}
local finaldata = http:JSONEncode(data)
http:PostAsync(url, finaldata)
end)
I am guessing that this isn’t a local script
we can get the player using PlayerAdded
local http = game:GetService("HttpService")
local players = game:GetService("Players")
local url = ""
players.PlayerAdded:Connect(function(player)
local data = {
embeds = {{
title = "New Member!",
description = player.Name.."is our new member! Congrats 🥳"
}}
}
http:PostAsync(url, http:JSONEncode(data))
end)