RemotEvent Serverscript not recieving values properly

So, i’m very fed up of this and i have tried like a million things.
The serverscript needs to recieve a string sent by localscript. It will send a message to webhook.
This is what it should send:


And this is the result:
image

Please help me out. I’m literally about to abandon this project.
These are my scripts:

Local:

local player = game.Players.LocalPlayer
game.ReplicatedStorage.PaymentSucessBusFirst.OnClientEvent:Connect(function()
	local check = math.random(300,400)
	local reciept1 = math.random(10000,99999)
	local reciept2 = math.random(100,999)
	script.Parent.text1.Text = "Printing reciept..."
	script.Parent.ProcessingFirst.checkingnumber.Text = ("Checking Number: Ibis " .. check)
	script.Parent.ProcessingFirst.recieptno.Text = ("Reciept " .. reciept1 .. game.Players.LocalPlayer.UserId .. reciept2 .. "110")
	wait(math.random(3,25))
	script.Parent.ProcessingFirst.Visible = true
    -- code after here is most relevant
	local sendmsg = ("New purchase has been made Renting Place - User and Id:".. game.Players.LocalPlayer.Name .. " " .. game.Players.LocalPlayer.UserId .. " Checking No: Ibis " .. check .. " Reciept No " .. reciept1 .. game.Players.LocalPlayer.UserId .. reciept2 .. "110 Product 110 Building Rent First Time Payment - React with check to confirm payment has been processed")
	print(tostring(sendmsg))
	game.ReplicatedStorage.SendWebhookmsg:FireServer(player, sendmsg)
end)

Server

game.ReplicatedStorage.SendWebhookmsg.OnServerEvent:Connect(function(player, sendmsg)
	wait(1)
	local httpService = game:GetService("HttpService")
	httpService:PostAsync("https://webhook.lewisakura.moe/api/webhooks/",
		httpService:JSONEncode({
			content = tostring(sendmsg)
		})
	)
end)

You are giving the Player as the first parameter, on RemoteEvent.OnServerEvent, the first parameter is automatically given, which is the Player who fired he Event, so when giving values, the first parameter under OnServerEvent is ignored when using :FireServer(), and gives the value to the 2nd parameter, making it the first parameter

So Basically, remove player from :FireServer()

It’s still the same response from the webhook

Are you sure you did exactly what I said?

game.ReplicatedStorage.SendWebhookmsg:FireServer(sendmsg) -- this is what I meant

Oh wait, I removed player from both scripts. Now it works perfectly, thank you!

OnServerEvent recieves the player automatically from the locascript, so the actual thing you should do is:

-- LocalScript:
game.ReplicatedStorage.SendWebhookmsg:FireServer(sendmsg)

-- Script:
game.ReplicatedStorage.SendWebhookmsg.OnServerEvent:Connect(player, sendmsg) 
wait(1)
	local httpService = game:GetService("HttpService")
	httpService:PostAsync("https://webhook.lewisakura.moe/api/webhooks/",
		httpService:JSONEncode({
			content = tostring(sendmsg)
		})
	)
end)
1 Like

if that got your issue solved, mark it as the solution, rather than leaving the thread open.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.