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)

2 comments
I'd recommend putting print is several lines of code see where it stops. Question though, do you have a script handling invocations to rFunction, the code on line 25? Otherwise the script will just sit there.
When you use :FireServer, the player instance is automatically the first argument of .OnServerEvent, so you don't need to provide one in the local script, else you'll return 4 arguments instead of 3.