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

The value won't change but the text will?

Asked by
Ieowyyn 69
4 years ago
Edited 4 years ago
--|| Variables ||--
local Vote2Button = script.Parent.butt
local Vote1Button = script.Parent.on
local Vote2Text = script.Parent.oof
local Vote1Text = script.Parent.poof

--|| Script ||--
Vote1Text.Value.Changed:Connect(function()
    Vote1Text.Text = Vote1Text.Value.Value
end)

Vote2Text.Value.Changed:Connect(function()
    Vote2Text.Text = Vote2Text.Value.Value
end)

Vote1Button.MouseButton1Click:Connect(function()
    Vote1Text.Text = Vote1Text.Value.Value+1
end)

Vote2Button.MouseButton1Click:Connect(function()
    Vote2Text.Text = Vote2Text.Value.Value+1
end)

So this script is supposed to be a voting system, the Text of "oof" and "poof" would change but their values wouldn't because of this problem the Text can't add anymore it stays at 1.

1 answer

Log in to vote
0
Answered by 4 years ago

You are just Setting the Text to the Value + 1. I would do this:

--|| Variables ||--
local Vote2Button = script.Parent.butt
local Vote1Button = script.Parent.on
local Vote2Text = script.Parent.oof
local Vote1Text = script.Parent.poof

--|| Script ||--
Vote1Text.Value.Changed:Connect(function()
    Vote1Text.Text = Vote1Text.Value.Value
end)

Vote2Text.Value.Changed:Connect(function()
    Vote2Text.Text = Vote2Text.Value.Value
end)

Vote1Button.MouseButton1Click:Connect(function()
    Vote1Text.Value.Value = Vote1Text.Value.Value+1
    Vote1Text.Text = Vote1Text.Value.Value
end)

Vote2Button.MouseButton1Click:Connect(function()
     Vote2Text.Value.Value = Vote2Text.Value.Value+1
    Vote2Text.Text = Vote2Text.Value.Value
end)
0
Ah okay, thanks. Ieowyyn 69 — 4y
Ad

Answer this question