Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Second value doesn't decrease?

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.