Problem with remoteEvents, I think

So I am making a system for citations in a roleplay group, and I was making sure it all worked. The problem I have been facing is that when I submit the citation, it prints with no answer, except for the player. I have checked, it all seems to line up when it comes to parent.parent, someone help? If you need more pictures just ask me. Thanks so much!

local player = script.Parent.Parent.Parent.Parent.Parent.Name
local Reason = script.Parent.Parent:WaitForChild("Reason").Text
local Citee = script.Parent.Parent:WaitForChild("Citee").Text
local Amount = script.Parent.Parent:WaitForChild("Amount").Text
local Timer = script.Parent.Parent:WaitForChild("Time").Text
local remoteEvent = game.ReplicatedStorage.Citation.CitationSubmitted

script.Parent.Activated:Connect(function()
remoteEvent:FireServer(player, Reason, Citee, Amount, Timer)
end)
local remoteEvent = game.ReplicatedStorage.Citation.CitationSubmitted

local function onCitationFired(player, Reason, Citee, Amount, Timer)
	print(player)
	print(Reason)
	print(Citee)
	print(Amount)
	print(Timer)
end

remoteEvent.OnServerEvent:Connect(onCitationFired)

If t he player you’re firing in FireServer your player or a different player? If it’s yours, remove it from the FireServer

remoteEvent:FireServer(Reason, Citee, Amount, Timer)

Player who fired the event is passed in automatically

1 Like

It is my player, but I need that information for the citation. What do you mean by it’s skipped?

Player is automatically passed in fireserver.

remoteevent.OnServerEvent:Connect(function(player, arg)
    print(player) -- will print the player who fired it
    print(arg)
end)
-- local script
remoteevent:FireServer(arg)

we have said this like 10 times pls stop

When you fire to a remoteEvent using FireServer the player who fired the event is passed in automatically, if you set it yourself in this case, it assumes that you want to set it to the Reason parameter. You don’t have it in yourself, it does so itself, and the code will still work after removing it and it’ll fix your issues you may be having

1 Like

Alright but the rest of them still come up as null, how do I solve that?

Also thanks for this, this solved at least one of my issues

For that issue, you just have to change your localscript around, change it to thsi

local frame = script.Parent.Parent
local Reason = frame:WaitForChild("Reason")
local Citee = frame:WaitForChild("Citee")
local Amount = frame:WaitForChild("Amount")
local Timer = frame:WaitForChild("Time")
local remoteEvent = game.ReplicatedStorage.Citation.CitationSubmitted

script.Parent.Activated:Connect(function()
remoteEvent:FireServer(Reason.Text, Citee.Text, Amount.Text, Timer.Text)
end)

Variable to reduce repetition and reference the Text property when you activate the button, it’s probably receiving nil because it immediately gets the text property even if yuo didn’t activate the button

1 Like