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

Map vote does not want to add a int-value?

Asked by 4 years ago

hello great people hope you are having a great dag im having a problem and it is that im making a map vote system it work 100% (thanks to the best person in the world Prestory i give big credit to him) and then i added so if the timer is done the vote thing is doen and the map spawns in BUT now i did all the scripting and now the hole thing does not want to work here is the scripts

---sever side script---

game.ReplicatedStorage.Mapvote1.OnServerEvent:Connect(function(player,map)
    if script.Parent.Parent.Mathdone.Value == true and script.Parent.didvote.Value == false then
             script.Parent.didvote.Value = true
             local Map = script.Parent:WaitForChild(map)
             Map:WaitForChild('votevalue').Value = Map.votevalue.Value + 1            
        end
end)
local DidVote = script.Parent.Parent.didvote.Value

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

here is the map spawn in thing

this is a local script

repeat
    wait()
until script.Parent.Parent.Mathdone.Value == true

script.Parent.Visible = true
game.ReplicatedStorage.Countdown:FireServer()

wait(15)

if script.Parent.Map1.Value > script.Parent.Map2.Value and script.Parent.Map1.Value > script.Parent.Map3.Value then
    local map = script.Parent.Parent.Map1.mapname.Value
    local clone = game.Lighting[map]:Clone()
    clone.Parent = game.Workspace
    clone.Name = "Map"
elseif script.Parent.Map2.Value > script.Parent.Map1.Value and script.Parent.Map2.Value > script.Parent.Map3.Value then
    local map = script.Parent.Parent.Map2.mapname.Value
    local clone = game.Lighting[map]:Clone()
    clone.Parent = game.Workspace
    clone.Name = "Map"
elseif script.Parent.Map3.Value > script.Parent.Map1.Value and script.Parent.Map3.Value > script.Parent.Map2.Value then
    local map = script.Parent.Parent.Map3.mapname.Value
    local clone = game.Lighting[map]:Clone()
    clone.Parent = game.Workspace
    clone.Name = "Map"
else
    print("No Map")


script.Parent.Visible = false
end

And here is the rename script (narmal script/ sever side script)

repeat
    wait()
until script.Parent.Parent.Mathdone.Value == true

local nr = math.random(1,1)

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

script.Parent.Mapname1.Name = map1

local nr2 = math.random(2,2)

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

script.Parent.Mapname2.Name = map2

local nr3 = math.random(3,3)

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

script.Parent.Mapname3.Name = map3



1 answer

Log in to vote
0
Answered by
Prestory 1395 Moderation Voter
4 years ago

The map values are not located inside the frame but outside so you need to do script.Parent.Parent and clone the map correctly like this

repeat
    wait()
until script.Parent.Parent.Mathdone.Value == true

script.Parent.Visible = true
game.ReplicatedStorage.Countdown:FireServer()

wait(15)

if script.Parent.Parent.Map1.Value > script.Parent.Parent.Map2.Value and script.Parent.Parent.Map1.Value > script.Parent.Parent.Map3.Value then
    local map = script.Parent.Parent.Map1.mapname.Value
    local clone = game.Lighting[map]:Clone()
    clone.Parent = game.Workspace
    clone.Name = "Map"
elseif  script.Parent.Parent.Map2.Value >  script.Parent.Parent.Map1.Value and  script.Parent.Parent.Map2.Value >  script.Parent.Parent.Map3.Value then
    local map = script.Parent.Parent.Map2.mapname.Value
    local clone = game.Lighting[map]:Clone()
    clone.Parent = game.Workspace
    clone.Name = "Map"
elseif  script.Parent.Parent.Map3.Value >  script.Parent.Parent.Map1.Value and  script.Parent.Parent.Map3.Value >  script.Parent.Parent.Map2.Value then
    local map = script.Parent.Parent.Map3.mapname.Value
    local clone = game.Lighting[map]:Clone()
    clone.Parent = game.Workspace
    clone.Name = "Map"
else
    print("No Map")


script.Parent.Visible = false
end

Ad

Answer this question