To be more specific, i'm trying to make a game (again XD). I was trying to send multiple augments from a server script to a local script. I got this error from the server script : Unable to cast value to Object And this error from the local script : attempt to call field 'OnClientEvent' (a userdata value)
Code in server script :
for i,v in pairs(game.ReplicatedStorage.Maps:GetChildren()) do --This part chooses the map, mybe a gamemode aswell, someday
if not ChoseMapBolean then
local RandomMapValue = math.random(1,2)
if RandomMapValue == 2 then
print(v)
ChosenMap = v
ChoseMapBolean = false
script.RemoteEvent:FireClient({v , "ForMap"}) -- The first part of are table is the value, the second is what its for and before you say "OMG lamo wat if al da math.randoms are 1" I have a fix for that
end
end
end
Code in local script :
game.ServerScriptService.GameScript.RemoteEvent.OnClientEvent(function(Aguments)
if Aguments[2] == "ForMap" then
SG.VoteForMap.JoinButton.Text = "Classic | " .. Aguments[1] .. " | PLayers : idk"
end
end)

1 comment
I made a video specifically for explaining this that should answer your question: https://www.youtube.com/watch?v=4Dc_bri9mjs