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

Voting System Int value is not changing?

Asked by 4 years ago

i have a remote event so when the player clicks something it votes and i have values on which one is being voted and it shows no error

script.Parent.Votes.OnServerEvent:connect(function(player, voted, selection)
    if selection == "p1" then
        script.p1.Value = script.p1.Value + 1

        if voted == true then
            script.p2.Value = script.p2.Value - 1
        end
        print("works")
    elseif selection == "p2" then
        script.p2.Value = script.p2.Value + 1

        if voted == true then
            script.p1.Value = script.p1.Value - 1
        end
        print("works")
    end
end)

Local script

game.ReplicatedStorage.Votes2.OnClientEvent:Connect(function()
    script.Parent.Image = ("http://www.roblox.com/Thumbs/Avatar.ashxx=100&y=100&Format=Png&username=%s"):format(game.Workspace.CurrentDebater1.Vaule)   
end)
script.Parent.MouseButton1Down:Connect(function()
    local pir = game.Players.LocalPlayer
    game.ReplicatedStorage.Votes:FireServer(pir , pir.Voted.Value, "p1")
    pir.Voted.Value = true
    script.Parent.TextLabel.Visible = true
    script.Parent.Parent.p2.TextLabel.Visible = false
    print("fired")
end)
wait(10)
game.Players.LocalPlayer.Voted = false

it says fired but not works

0
you can't fire multiple times in one remote event! ImAnonymousBan 24 — 4y
0
sorry wrong lol|... i mean you can't add multiples variable in once remotevent i try it and it doesn't work! ImAnonymousBan 24 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Well when you fire your remote event, your sending pir, pir.Voted.Value, and "p1". When remote functions or events are fired, they auto send the player as a variable in the first slot. So that means you can just remove the pir from your firing event. Right now the server script thinks voted is actually pir.

0
Oh because i had player as a variablue and i didnt want to mess it up User#22145 0 — 4y
Ad

Answer this question