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

Why doesn't this value change? {SOLVED IN COMMENTS}

Asked by 8 years ago

Hey guys!

I apologize in advance for a LONG POST

The following script should decrease/increase the value of Gold from 1K, 10K or 100K to 1K, 10K or 100K. Confused? Here's what I mean: Value is 1000 - Increases to 10K when "+" button is pressed Value is 100K - Decreases to 10K when "-" button is clicked But the script does not change the value when the value is 10K. To explain it further: When I click the + button, it stays at 10K. Same applies to the - button.

This script INCREASES the value The problem in this code is when the text is NOT green.

Frame = script.Parent.Parent
--[[ NOTES:
    AMOUNTS

    GOLD: 1K, 10K, 100K
    POINTS: 5, 10, 15
--]]
script.Parent.MouseButton1Click:connect(function()
    if Frame.Amt.Value >= 100000 and Frame.Type.Value == "Gold" then
        script.Parent.Parent.Amt.Value = 100000
        script.Parent.Text = "Maximum amount is 100K Gold"
        wait(0.5)
        script.Parent.Text = "+"
    elseif script.Parent.Parent.Amt.Value == 10000 and Frame.Type == "Gold" then
        Frame.Amt.Value = 100000
    elseif Frame.Amt.Value == 1000 and Frame.Type.Value == "Gold" then
        Frame.Amt.Value = 10000
    --[[elseif Frame.Amt.Value >= 15 and Frame.Type.Value == "Points" then
        script.Parent.Text = "Maximum amount is 15 Points"
        wait(0.5)
        script.Parent.Text = "+"
        Frame.Amt.Value = 15
    elseif Frame.Amt.Value == 10 and Frame.Type.Value == "Points" then
        Frame.Amt.Value = 15
    elseif Frame.Amt.Value == 5 and Frame.Type.Value == "Points" then
        Frame.Amt.Value = 10]]
    end
end)

This script DECREASES the value The problem lies where the text is NOT green

Frame = script.Parent.Parent
--[[ NOTES:
    AMOUNTS

    GOLD: 1K, 10K, 100K
    POINTS: 5, 10, 15
--]]
script.Parent.MouseButton1Click:connect(function()
    if Frame.Amt.Value <= 1000 and Frame.Type.Value == "Gold" then
        script.Parent.Parent.Amt.Value = 1000
        script.Parent.Text = "Minimum amount is 1000 Gold"
        wait(0.5)
        script.Parent.Text = "-"
    elseif script.Parent.Parent.Amt.Value == 10000 and Frame.Type == "Gold" then
        Frame.Amt.Value = 1000
    elseif Frame.Amt.Value == 100000 and Frame.Type.Value == "Gold" then
        Frame.Amt.Value = 10000
    --[[elseif Frame.Amt.Value <= 5 and Frame.Type.Value == "Points" then
        script.Parent.Text = "Minimum amount is 5 Points"
        wait(0.5)
        script.Parent.Text = "-"
        Frame.Amt.Value = 5
    elseif Frame.Amt.Value == 10 and Frame.Type.Value == "Points" then
        Frame.Amt.Value = 5
    elseif Frame.Amt.Value == 15 and Frame.Type.Value == "Points" then
        Frame.Amt.Value = 10]]
    end
end)
0
I honestly appreciate when people do long posts; at least I'm more likely know what the heck they want and what I'm trying to answer. Legojoker 345 — 8y
0
Is it because in line 14 in each of your scripts, it is Frame.Typre, not Frame.Type.Value? User#9949 0 — 8y
0
Lego: Thumbs up maybe :) fahmisack123 385 — 8y
0
Turtle.. THANKS! Well Spotted! fahmisack123 385 — 8y

1 answer

Log in to vote
-1
Answered by
narfh 0
8 years ago
Frame = script.Parent.Parent
--[[ NOTES: 
    AMOUNTS 
    GOLD: 1K, 10K, 100K 
    POINTS: 5, 10,15
--]] 

script.Parent.MouseButton1Click:connect(function() 
    if Frame.Amt.Value <= 1000 and Frame.Type.Value == "Gold" then 
        script.Parent.Parent.Amt.Value = 1000 
        script.Parent.Text = "Minimum amount is 1000 Gold" 
        wait(0.5) 
        script.Parent.Text = "-"  
    elseif script.Parent.Parent.Amt.Value == 10000 and Frame.Type == "Gold" then
        Frame.Amt.Value = 1000 
    elseif Frame.Amt.Value == 100000 and Frame.Type.Value == "Gold" then 
        Frame.Amt.Value = 10000 
    --[[elseif Frame.Amt.Value <= 5 and Frame.Type.Value == "Points" then
        script.Parent.Text = "Minimum amount is 5 Points" 
        wait(0.5) 
        script.Parent.Text = "-" 
        Frame.Amt.Value = 5 
    elseif Frame.Amt.Value == 10 and Frame.Type.Value == "Points" then 
        Frame.Amt.Value = 5 
    elseif Frame.Amt.Value == 15 and Frame.Type.Value == "Points" then 
        Frame.Amt.Value = 10]] 
    end 
end) 
Ad

Answer this question