Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

vote map system does not work?

Asked by 5 years ago
Edited 5 years ago

hello beautiful people hope you are having a great dag I'm making a gun game game with a map vote system BUT I made it so it is global but after i did the hole thing did not work here is all the scripts

---sever side script---

game.ReplicatedStorage.Mapvote1.OnServerEvent:Connect(function(player,map)
    if game.ReplicatedStorage.Mathdone.Value == true and script.Parent.didvote.Value == false then
             script.Parent.didvote.Value = true
             local Map = script.Parent:WaitForChild(map)
             local value = Map:WaitForChild('votevalue').Value --- the value is "game.ServerStorage.For1.Value" and i change it to all the maps
            value = value +1
game.ReplicatedStorage.winner.OnServerEvent:Connect(function()
        value = 0

    end)          
        end
end)

other script in the same place

---sever side script---

repeat
    wait()
until game.ReplicatedStorage.Mathdone.Value == true

local nr = math.random(1,1)

local map1 = game.Lighting['Map'..nr].Value.Value
game.ReplicatedStorage.Map1.mapname.Value = 'Map'..nr

script.Parent.Mapname1.Name = map1

local nr2 = math.random(2,2)

local map2 = game.Lighting['Map'..nr2].Value.Value
game.ReplicatedStorage.Map2.mapname.Value = 'Map'..nr2

script.Parent.Mapname2.Name = map2

local nr3 = math.random(3,4)

local map3 = game.Lighting['Map'..nr3].Value.Value
game.ReplicatedStorage.Map3.mapname.Value = 'Map'..nr3

script.Parent.Mapname3.Name = map3

other script in the same place


---sever side script--- game.ReplicatedStorage.winner.OnServerEvent:Connect(function() wait(15) if game.ReplicatedStorage.Map1.Value > game.ReplicatedStorage.Map2.Value and game.ReplicatedStorage.Map1.Value > game.ReplicatedStorage.Map3.Value then local map = game.ReplicatedStorage.Map1.mapname local clone = game.Lighting[map.Value]:Clone() clone.Parent = game.Workspace clone.Name = "Map" elseif game.ReplicatedStorage.Map2.Value > game.ReplicatedStorage.Map1.Value and game.ReplicatedStorage.Map2.Value > game.ReplicatedStorage.Map3.Value then local map = game.ReplicatedStorage.Map2.mapname local clone = game.Lighting[map.Value]:Clone() clone.Parent = game.Workspace clone.Name = "Map" elseif game.ReplicatedStorage.Map3.Value > game.ReplicatedStorage.Map2.Value and game.ReplicatedStorage.Map3.Value > game.ReplicatedStorage.Map1.Value then local map = game.ReplicatedStorage.Map3.mapname local clone = game.Lighting[map.Value]:Clone() clone.Parent = game.Workspace clone.Name = "Map" else local nr = math.random(1,4) local map = 'Map'..nr local clone = game.Lighting[map]:Clone() clone.Parent = game.Workspace clone.Name = "Map" script.Parent.Parent.Enabled = false wait(1) end end)

this is in the button

--- local script---

local DidVote = script.Parent.Parent.didvote.Value

    script.Parent.MouseButton1Click:Connect(function()
    if not DidVote then
    game.ReplicatedStorage.Mapvote1:FireServer(script.Parent.Name)
    end
    end)

please help

Answer this question