So I am making a murder game and I was trying to make it so it says the chosen game and spawns it in. I am doing this through a** LOCAL SCRIPT** because I am FireAllClients form the Script. Also the error is "Players.Nosh4309.PlayerGui.LocalScript:21: attempt to concatenate local 'gameChosen' (a userdata value)" What does this mean? I cant change it form not being local (Also the problem is** line 17 to 21**)
local client = game:GetService("Players").LocalPlayer
local RepStore = game:GetService("ReplicatedStorage")
local remote = RepStore.remote -- LOCATING THE REMOTE
local repstore = game.ReplicatedStorage
--
local Maps = repstore.Maps:GetChildren()
local School = repstore.Maps.School
local Beach = repstore.Maps.Beach
remote.OnClientEvent:Connect(function()
local pgui1 = client.PlayerGui
pgui1:WaitForChild("ScreenGui").TextLabel.Text = "Starting game!"
wait(3)
local pgui = client.PlayerGui
pgui:WaitForChild("ScreenGui").TextLabel.Text = "Choosing a map"
wait(3)
local RanGame = math.random(1,#Maps)
local gameChosen = Maps[RanGame] --Problem is here
local pgui = client.PlayerGui
pgui:WaitForChild("ScreenGui").TextLabel.Text = "Map chosen ".. gameChosen --end
wait(1)
local gameChosenClone = gameChosen:Clone()
if gameChosenClone.Name == "Beach" then
Beach:Clone().Parent = game.Workspace.MapSelected
elseif gameChosenClone.Name == "School" then
School:Clone().Parent = game.Workspace.MapSelected
end
end)

1 comment
The reason is because you attempted to concatenate the map itself. Add a .Name. And you should clone maps on the server, that way they replicate. If that's not your desire then you can disregard what I said.