Need help with a Remote Event

When i fire a remote event it will fire once, but if i try to fire it again it wont fire.
My code: – Local Script

local Event = game.ReplicatedStorage.Events.TradeRequest
local Player = game.Players:GetPlayerByUserId(script.Parent.Parent.Parent.Parent.Player.Value)
local LocalPlayer = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()

	Event:FireServer(Player,LocalPlayer)
end)

The code that receves the request: – server script

game.ReplicatedStorage.Events.TradeRequest.OnServerEvent:Connect(function(Player,LocalPlayer)
	script.Parent.Visible = true
	script.Parent.Desc.Text = LocalPlayer.Name.."  sent you a trade request!"
end)

What am i doing wrong?

Can you show where guis that you to function on the explorer like screenshot it

The Server Script:
Screenshot 2022-04-02 195245
The Local Script:
Screenshot 2022-04-02 195315

FireServer automatically takes the Player [who fired the event], which means you don’t have to put any argument that relats to the local player itself.

So what happens accordingly to your adjustments,
1st argument in FireServer is equal to 1st in OnServerEvent
2nd argument in FireServer is equal to 2nd in OnServerEvent

And that’s a problem, why?

Because:

1-OnServerEvent’s first argument is always the Player.
2-As I said before, FireServer automatically takes the Player as 1st argument.

Note
If you have 1+ arguments in FireServer event, on the server [OnServerEvent], you’ll have to put that amount of arguments BUT plus 1[which is the first one to be put, which is the Player].

1 Like

It still only firers the event once

put a print in the server script and the client script and check the output
if it does print then it still work

--Server
game.ReplicatedStorage.Events.TradeRequest.OnServerEvent:Connect(function(Player,PlayerID)
	script.Parent.Visible = true
	script.Parent.Desc.Text = Player.Name.."  sent you a trade request!"
end)

--Client

local Event = game:GetService("ReplicatedStorage").Events.TradeRequest
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerID = LocalPlayer.UserId

script.Parent.MouseButton1Click:Connect(function()
    Event:FireServer(PlayerID)
end)

1 Like

i fixed it! Thank you guys for all your help!

2 Likes