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

Second value doesn't decrease?

Asked by
2_MMZ 1059 Moderation Voter
2 years ago

Hello. I'm remastering a game(which will remain anonymous for now.) The game features a map voting, and a countdown. When the player clicks the vote button, it allows them to add a vote, and only one. (Which works). The other part of the script constantly changes the "timeleft" text to "val2" which is how much time is left. But that doesn't work. Can I get any assistance on this? Here's my code:

local remEvent = game.ReplicatedStorage.Remotes:WaitForChild("RemoteEvent")
local remEvent2 = game.ReplicatedStorage.Remotes:WaitForChild("RemoteEvent2")
local val = script.Parent.votin.votes.votesgiven
local val2 = script.Parent.votin.timeleft.decreasing
local gui = script.Parent

remEvent.OnServerEvent:Connect(function()
    for i = 1,1 do
        val.Value = val.Value + 1
    end
    print(val.Value)
    script.Parent.votin.votes.Text = ""..val.Value
end)

remEvent2.OnServerEvent:Connect(function()
    wait(1)
    val2.Value = val2.Value - 1
end)

while true do
    wait(0.1)
    script.Parent.votin.timeleft.Text = ""..val2.Value
end

Any working answer is appreciated.

1 answer

Log in to vote
1
Answered by 2 years ago
Edited 2 years ago

Change line 22 from

script.Parent.votin.timeleft.Text = ""..val2.Value

to

script.Parent.votin.timeleft.Text = val2.Value

If that doesn't work then try this

copy lines 20-23 and delete lines 20-23 then create another script that is the same parent as the original script

Then paste in lines 20-23 on the new script

Ad

Answer this question