Hello.
I’m trying to send a log message for a hand-to system for tools, using a Discord webhook, but it won’t allow me to use values inside of the content of what it should send, and is coming up with an error. Any help on how to fix this would be appreciated, thanks!
local HandtoEvent = game.ReplicatedStorage.HandtoEvent
local ConfirmHandtoEvent = game.ReplicatedStorage.ConfirmHandtoEvent
HandtoEvent.OnServerEvent:Connect(function(Player, NameOfPlayerToGive)
local PlayerToGive = game.Players:FindFirstChild(NameOfPlayerToGive)
local Character = Player.Character
local CurrentlyEquippedTool = Character:FindFirstChildWhichIsA("Tool")
local ConfirmGUI = PlayerToGive.PlayerGui.ConfirmGUI
if CurrentlyEquippedTool.Name == "Magic" then
ConfirmGUI.Enabled = false
else
if CurrentlyEquippedTool.Name == "GravityCoil" then
ConfirmGUI.Enabled = false
else
if CurrentlyEquippedTool.Name == "SpeedCoil" then
ConfirmGUI.Enabled = false
else
if CurrentlyEquippedTool.Name == "ManagementWacker" then
ConfirmGUI.Enabled = false
else
if CurrentlyEquippedTool.Name == "Mop" then
ConfirmGUI.Enabled = false
else
if CurrentlyEquippedTool.Name == "Gold" then
ConfirmGUI.Enabled = false
else
if CurrentlyEquippedTool.Name == "GoldCupcake" then
ConfirmGUI.Enabled = false
else
ConfirmGUI.Enabled = true
print(ConfirmGUI.Enabled)
ConfirmGUI.BackFrame.ConfirmText.Text = Player.Name .. " is handing you a " .. CurrentlyEquippedTool.Name .. ". Would you like to accept?"
ConfirmGUI.PlayerWhoGaveItem.Value = Player.Name
ConfirmGUI.ItemThatWasGiven.Value = CurrentlyEquippedTool
CurrentlyEquippedTool.Parent = ConfirmGUI
end
end
end
end
end
end
end
end)
ConfirmHandtoEvent.OnServerEvent:Connect(function(Player, Confirm)
local ConfirmGUI = Player.PlayerGui.ConfirmGUI
local NameOfPlayerWhoGaveItem = ConfirmGUI:WaitForChild("PlayerWhoGaveItem").Value
local ItemThatWasGiven = ConfirmGUI:WaitForChild("ItemThatWasGiven").Value
if Confirm == true then
ItemThatWasGiven.Parent = Player:WaitForChild("Backpack")
game.Players[NameOfPlayerWhoGaveItem].leaderstats.Points.Value = game.Players[NameOfPlayerWhoGaveItem].leaderstats.Points.Value + 1
local http = game:GetService("HttpService")
local Data = {
["content"] = Player.Name..NameOfPlayerWhoGaveItem..ItemThatWasGiven
}
Data = http:JSONEncode(Data)
http:PostAsync("webhookurl", Data)
ConfirmGUI.PlayerWhoGaveItem.Value = ""
ConfirmGUI.ItemThatWasGiven.Value = nil
else
ItemThatWasGiven.Parent = game.Players[NameOfPlayerWhoGaveItem].Backpack
end
ConfirmGUI.Enabled = false
end)