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

Map votes not showing when they should?

Asked by 2 years ago

Hi, so I made a map voting system for my game, but im trying to make it so it constantly shows the votes but for some reason the text doesnt change at all, so it just stays saying "Choice1." Does anybody know how i can fix this? Thanks.

local script inside the gui

local player = game:GetService("Players").LocalPlayer
local voted = player:WaitForChild("voted")
local rep = game:GetService("ReplicatedStorage")
local votere = rep:WaitForChild("RemoteEvent"):WaitForChild("Vote")
local variables = rep:WaitForChild("Variables")
local boolean = rep:WaitForChild("Booleans"):WaitForChild("RevealVotes")
local choice = variables:WaitForChild("Choice3")
local votechoice = variables:WaitForChild("VoteChoice3")
local votescounter = script.Parent.Parent.Parent.Votesmenu:WaitForChild("Votes1")

local map = choice.Value
    if choice.Value then
    script.Parent.Title.Text = map.Name
    script.Parent.Icon.Image = map:FindFirstChild("Decal").Texture
    script.Parent.Creators.Text = "By "..map:FindFirstChild("Creators").Value
    end
choice:GetPropertyChangedSignal("Value"):Connect(function()
    local map = choice.Value
        if choice.Value then
        script.Parent.Title.Text = map.Name
        script.Parent.Icon.Image = map:FindFirstChild("Decal").Texture
        script.Parent.Creators.Text = "By "..map:FindFirstChild("Creators").Value
        end
end)

if voted.Value == true then
    script.Parent.VOTE.Visible = false
else
    script.Parent.VOTE.Visible = true
end

voted:GetPropertyChangedSignal("Value"):Connect(function()
    if voted.Value == true then
        script.Parent.VOTE.Visible = false
    else
        script.Parent.VOTE.Visible = true
    end
end)

script.Parent.VOTE.MouseButton1Click:Connect(function()
    votere:FireServer(choice.Name)
end)

votechoice:GetPropertyChangedSignal("Value"):Connect(function()
    votescounter.Text = map.Name..": "..votechoice.Value
end)

serverscript that adds the votes

local rep = game:GetService("ReplicatedStorage")
local variables = rep:WaitForChild("Variables")
local vote1 = variables:FindFirstChild("VoteChoice1")
local vote2 = variables:FindFirstChild("VoteChoice2")
local vote3 = variables:FindFirstChild("VoteChoice3")
local votere = rep:WaitForChild("RemoteEvent"):WaitForChild("Vote")


votere.OnServerEvent:Connect(function(plr,choice)

    plr:WaitForChild("voted").Value = true
    if choice == "Choice1" then
        vote1.Value = vote1.Value + 1
    elseif choice == "Choice2" then
        vote2.Value = vote2.Value + 1
    elseif choice == "Choice3" then
        vote3.Value = vote3.Value + 1
    end
end)
0
can u send a img sne_123456 439 — 2y

Answer this question