Let me explain what's its suppose to do,
When someone clicks the button, it will tell the system to send a message in a channel. The bot or webhook will say "(game player) is noob) I've tried messing with it, no luck.
Output: 6:18:37.951 - Http requests can only be executed by game server
script.Parent.Body1.Search.MouseButton1Click:Connect(function() local Players = game:GetService("Players") local Player = Players.LocalPlayer local HttpService = game:GetService("HttpService") local webhook = "webhook" local msg = Player.Name.."is noob" local data = { content = msg; } HttpService:PostAsync(webhook, HttpService:JSONEncode(data)) end)
All you have to do is set up a RemoteEvent and pass in the msg data. Then inside of the server you can handle the HttpService stuff.
You have to do it like this because "Http requests can only be executed by game server".
Try this
--//Local script local Remote = game.ReplicatedStorage:WaitForChild("HttpEvent") script.Parent.Body1.Search.MouseButton1Click:Connect(function() local Players = game:GetService("Players") local Player = Players.LocalPlayer local msg = Player.Name.."is noob" local data = { content = msg; } Remote:FireServer(data) end)
--//Server script local HttpService = game:GetService("HttpService") local webhook = "webhook" local Remote = game.ReplicatedStorage:FindFirstChild("HttpEvent") or Instance.new("RemoteEvent", game.ReplicatedStorage) Remote.Name = "HttpEvent" Remote.OnServerEvent:Connect(function(Player, Data) HttpService:PostAsync(webhook, HttpService:JSONEncode(Data)) end)