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

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

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)

4 comments

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.

0

Is it because in line 14 in each of your scripts, it is Frame.Typre, not Frame.Type.Value?

0

Lego: Thumbs up maybe :)

0

Turtle.. THANKS! Well Spotted!

1 answer

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) 

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