local players = gameModule.playersInRound
playerEvent.FireClient = function()
return players
end
Im trying to get the table of players so I can use in the local script.
local players = gameModule.playersInRound
playerEvent.FireClient = function()
return players
end
Im trying to get the table of players so I can use in the local script.
local players = gameModule.playersInRound
playerEvent:FireClient = function()
return players
end
try this:
local players = gameModule.playersInRound
playerEvent.FireClient:Connect(function()
return players
end)
@happle5222 FireClient
is a method to fire the remote event to the client side, not a RBXScriptSignal. If you are struggling with Remote Events, I suggest you take a read at Remote Functions and Events
Wait Hold up I messed up.
try this:
local players = gameModule.playersInRound
playerEvent:FireClient(plr, table)
end)
My memory is a little funky right now, I’m trying to put the pieces together because I haven’t read that in a little, but I do know.
then how would I get the table???for the client side script.
Haven’t you defined the table somewhere in this script? If you have, just change table to whatever you defined.
that is the table. The playersInRound is the table from the module.
Yes so this should work:
local players = gameModule.playersInRound
playerEvent:FireClient(plr, players)
end)
then what is the plr for???
Actually, remove that, thats useless, its already defined when the client recives that, you may delete that, thank you for catching my error.
If you are wanting to fire the event for ALL players then FireAllClients
should be used. If you want to fire for a specific client then you need to use FireClient
and specify the player as the first argument.
I recommend before trying to suggest a solution, make sure it works to prevent further confusion.
I want to reiterate that reading Remote Functions and Events would be highly beneficial.
another error
My goal here is the get the table from the server side and use it in the client side.
Use a RemoteFunction, not RemoteEvent.
Ok! I got everything up and running but how would I reset the playerfunction when the round is over?? Because for the first time it works, but then you would be able to spectate all the time right after.
toggle.MouseButton1Click:connect(function()
local players = playerFunction:InvokeServer()
otherFrame.Visible = false
otherFrame.Position = UDim2.new(0.499, 0, 0.369, 0)
otherFrame2.Visible = false
otherFrame2.Position = UDim2.new(0.499, 0, 0.369, 0)
if frame.Visible == false then
if #players < 1 then return end
debounce = true
frame.Visible = true
frame:TweenPosition(UDim2.new(0.218, 0, 0.646, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.0625, true)
debounce = false
elseif frame.Visible == true then
players = nil
debounce = true
frame.Visible = false
frame.Position = UDim2.new(0.218, 0, 0.716, 0)
debounce = false
end
end)
Edit the table that your returning through the remote in the serverscript.