So I have a script with a value, and that value is being passed through a :FireClient(). The local script then uses that value to define where to go in the module script, but it isn't working. I am not sure how to use the value in the local script, as it is currently trying to find "DoorType" and the value of DoorType, in the module.
Script
DoorType = "Chamber Door"
ButtonEvent:FireClient(Player, Active, DoorType)
LocalScript
ButtonEvent.OnClientEvent:Connect(function(Player, Active, DoorType)
if Active and plr:GetRankInGroup(ButtonMessageModule.DoorType.GroupID) == ButtonMessageModule.DoorType.RankID then
Module
local ButtonMessageModule = {}
ButtonMessageModule.ChamberDoor = {
Title = "Chamber Door",
OpenMessage = "Click to open the chamber door.",
CloseMessage = "Click to close the chamber door.",
Denied = "Don't touch.",
GroupID = 4386976,
RankID = 0,
}
return ButtonMessageModule

4 comments
In OnClientEvent you don't need the Player argument anymore. The second parameter in FireClient becomes the first in OnClientEvent. In your case, the current Player variable holds anything sent in Active and Active holds anything sent in DoorType. Since there is no more arguments sent after that, DoorType is nil in the LocalScript.
I get the following error, "attempt to index field 'DoorType' (a nil value)
DoorType should be "ChamberDoor" and to access the table, do ButtonMessageModule[DoorType].RankID.
Thank you, I will eventually understand how arguments work!