As you can read from the title im trying to send table values that are also have changing values from a local script to a server script. so the error I keep getting is
value of type nil cannot be converted to a number
The issue at hand is that the table values being sent are the original values, so whatever the original value of all the values were that is what’s being sent instead of the new updated values.
i’ve looked around the forum and Studio Documentation but I couldn’t find anything that helped or made sense (i’m not the best at scripting so this is all still pretty new to me) If anyone knows how to go about this it would be appreciated. I have an idea on how I could just go around this issue entirely, but it would take so long to do and I’d have to remake a large portion of the game so I’d rather find a solution for this if possible.
This is the local script
The -- code+
is just to show spaces where the code still extends off to but isn’t included within the example since its not very necessary since its just ripped straight out the script.
-- defaults
local SelectedGameMode = nil
local SelectedGameRounds = nil
local SelectedGameOpponent = nil -- t/bot f/plr
local GameSettings = {
SelectedGameMode,
SelectedGameRounds,
SelectedGameOpponent
}
-- code+
-- There are more of these but one should show what im trying to show with this
gametype5.MouseButton1Click:Connect(function()
SelectedGameMode = 5
GamemodeTxt.Text = "g5"
end)
-- code+
-- Sends to server
events.CreateRoom:FireServer(getRandomString(), GameSettings )
task.wait()
events.SendRoom.OnClientEvent:Connect(function(newMatchRoom)
Server Script
local function CreateLobby(plr, key, GameSettings)
local newMatchRoom = MatchRoom:Clone()
newMatchRoom.Name = key
newMatchRoom.Parent = workspace:WaitForChild("MatchRooms_Debris")
print(GameSettings[1])
newMatchRoom.GameSettings.Gamemode.Value = tonumber(GameSettings[1])
newMatchRoom.GameSettings.Rounds.Value = GameSettings[2]
newMatchRoom.GameSettings.Bot.Value = GameSettings[3]
sendRoomtoClient:FireClient(plr, newMatchRoom)
wait(3)
if GameSettings[3] == true then
AnimateSolo(plr, newMatchRoom)
elseif GameSettings[3] == false then
AnimatePlayer1(plr, newMatchRoom)
end
end
random example
once again the error I get is
value of type nil cannot be converted to a number
since the values sent aren’t updated
If anyone knows how I can go about fixing this that would be pretty awesomesauce
sorry if i left anything out or worded anything poorly, if you have any questions just ask ill try to answer to the best of my ability.