Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why are my remote event arguments returning nil? [Answered]

My game is FE so I need to use remote events and I want to pass arguments through them but when I reference them in my server scripts, they return nil?

--Local Script (inside a tool in Workspace)

tool = script.Parent
local guiuse = script.Parent.PowerGui:Clone()

local RepStorage = game:GetService('ReplicatedStorage')
local ToolEvents = RepStorage:WaitForChild("ToolEvents")
local Heavy = ToolEvents:WaitForChild("Heavy")
local Light = ToolEvents:WaitForChild("Light")

function heavy()
	Heavy:FireServer(script.Parent, guiuse)
end
function light()
	Light:FireServer(guiuse)
end

tool.Equipped:connect(heavy)
tool.Unequipped:connect(light)

--Server Script (inside ServerScriptService)

Heavy.OnServerEvent:connect(function(player, parent, guiuse)
	parent.Movement.Disabled = true
	guiuse.Parent=game.Players:GetPlayerFromCharacter(parent.Parent).PlayerGui
	parent.Movement.Disabled = false
end)

Light.OnServerEvent:connect(function(player, guiuse)
	guiuse.Parent = nil	
end)

1 answer

Almost every time I post a question, I figure it out 1 hour later. Anyways, I read more into this wiki page and it said that by default, player is passed through, which I totally neglected and added player anyway. After I removed the player variable because I didn't need it, it worked.

This discussion is preserved as it was. New answers, comments, and votes are closed.