I have a problem with making my maps be in ServerStorage, have the voting system GUI select the map name from ServerStorage, and show it to the client. (What I had before was 3 options without name or picture because they were in ServerStorage and the client couldn’t see it)
What I did was make a few dummy maps in Lighting, and have the name of those maps be referenced and found in ServerStorage, to get the real map that people voted for, what it does instead is an error. If anyone knows another way of doing this then please tell me because I’m stuck at this for hours.
This part below is the one where it errors. It errors at the part where it tries copying the map from ServerStorage. chosenmap.value is the map chosen by the majority players after they voted.
local map = chosenmap.Value
print(choice1,choice2,choice3,winner,map,chosenmap)
local map = ServerStorage:FindFirstChild(chosenmap.value) -- chosenmap.value is the name of the map that I'm trying to find btw root of the problem
local clonemap = map:Clone() -- This is used to clone it to workspace and it errors here
More pieces of the script for context, incase someone needs it to solve my problem.
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local mapsfolder = game:GetService("Lighting"):WaitForChild("Maps")
local booleans = ReplicatedStorage.VotingSystem:WaitForChild("Booleans")
local variables = ReplicatedStorage.VotingSystem:WaitForChild("Variables")
local choice1 = variables:FindFirstChild("Choice1")
local choice2 = variables:FindFirstChild("Choice2")
local choice3 = variables:FindFirstChild("Choice3")
local winner = variables:FindFirstChild("Winner")
local timer = 25 --in seconds
while true do
while true do
local maps = mapsfolder:GetChildren()
choice1.Value = maps[math.random(1,#maps)]
table.remove(maps,table.find(maps,choice1.Value))
choice2.Value = maps[math.random(1,#maps)]
table.remove(maps,table.find(maps,choice2.Value))
choice3.Value = maps[math.random(1,#maps)]
table.remove(maps,table.find(maps,choice3.Value))
wait(1)
booleans:FindFirstChild("VotingSession").Value = true
wait(20)
booleans:FindFirstChild("RevealVotes").Value = true
wait(10)
booleans:FindFirstChild("VotingSession").Value = false
booleans:FindFirstChild("RevealVotes").Value = false
local chosenmap = winner.Value
if not winner.Value then
print("Something went wrong!")
break
end
local map = chosenmap.Value
print(choice1,choice2,choice3,winner,map,chosenmap)
local map = ServerStorage:FindFirstChild(chosenmap.value)
local clonemap = map:Clone()
And yes I tried looking for this and I’m stuck for like 2 hours at this problem.
EDIT: Thanks for all the help.