Hey all! I'm a bit puzzled on how to use :FireServer(). No errors appear in the output, so I'm hoping You guys would be able to help. Thanks!
Local Script:
GUI = script.Parent.Parent.Parent.Parent Frame = GUI.CitationsDB Amount = Frame.Citation.Amount Citee = GUI.Citee Status = Frame.Status Player = game.Players.LocalPlayer Max = 250 RE = game.Workspace:WaitForChild("CitationScript"):WaitForChild("Event") script.Parent.MouseButton1Down:connect(function() if not game.Players:findFirstChild(Citee.Value) then Status.Text = "PLAYER NOT FOUND!" wait(3) Status.Text = "" else local Victim = game.Players:findFirstChild(Citee.Value) if not tonumber(Amount.Text) then Status.Text = "INVALID AMOUNT" wait(3) Status.Text = "" else if (tonumber(Amount.Text) > Max) then Amount.Text = 250 end local Response = game.ReplicatedStorage.Events.rFunction:InvokeServer("Subtract",(tonumber(Amount.Text)),Victim.Name) print(Response) if Response == "Transaction Completed." then Status.Text = "CITATION COMPLETED!" wait(3) Frame:TweenPosition(UDim2.new(0.5,-160,-1,-100),'Out','Quad',0.35) RE:FireServer(Player, Victim.Name, Amount.Parent.Reason.Text) wait(1) GUI:Destroy() else Status.Text = "PLAYER DOESN'T HAVE SUFFICIENT FUNDS!" wait(3) Status.Text = "" end end end end)
script:
RE = script:WaitForChild("Event") RE.OnServerEvent:connect(function(Player, Victim, Reason) if game.Players:findFirstChild(Victim) then local vic = game.Players:findFirstChild(Victim) game.Lighting.CitationNotif:clone().Parent = game.Players:findFirstChild(Victim).PlayerGui local GGUI = game.Players:findFirstChild(Victim).PlayerGui.CitationNotif GGUI.CitationNotif.Title.Text = Player.Name.." is charging you for '"..Reason.."'." GGUI.CitationNotif:TweenPosition(UDim2.new(0.5,-160,-0.5,-100),'Out','Quad',0.35) end end)
If you were to add a print statement right in your listener function to print the arguments (Player, Victim, Reason) .. Victim would print in the place of Player, and Reason in the place of Victim... leaving "Reason" a nil argument.
Why..? Because the player argument is automatically passed as first argument when firing RemoteEvents and RemoteFunctions from the client. Therefore, all you really need to do is pass the arguments following it.
In your code, RE:FireServer(Player, Victim.Name, Amount.Parent.Reason.Text)
would be RE:FireServer(Victim.Name, Amount.Parent.Reason.Text)