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

Why does my script fail to show a value change and then change text to that value?

So when the button is clicked it changes 3 booleans, Based on which button is pressed.


script.Parent.MouseButton1Click:Connect(function()
	game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.calculation01.Value = false
	game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.calculation02.Value = false
	game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.calculation03.Value = true
	wait(0.4)
	game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.totalcalculationlegs.Value = 140
	wait(0.4)
	print("Reached Here")
	wait(0.5)
	print(game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.calculation01.Value)
	print(game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.calculation02.Value)
	print(game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.calculation03.Value)
	print(game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.totalcalculationlegs.Value)
end)

This changes the booleans successfully but the value refuses to show change? It changes in the starterGUI.

When the value of totalcalculationlegs is changed it carries out this script.


game.StarterGui.MainMenu.OutfitPriceFrame.totalPrice.totalcalculationlegs.Changed:Connect(function()
	print(script.Parent.totalcalculationlegs.Value)
	wait(3)
	script.Parent.Parent.totalPrice.Text = script.Parent.totalcalculationlegs.Value
	print("Reached Here")
	wait(3) 
	print(script.Parent.totalcalculationlegs.Value)
end)
	

This fails to print the value of the current script.

The Value of intValue in StarterGUI remains at 140 though? and fails to change the text.

Here is the print out



  0                      - Initialtotalcalculationlegs.Value
  Reached Here - Confirmed Value Change
  false                 - Other Boolean False
  false                  - Other Boolean False
  true                   - Boolean i want true
  140                    - New Initialtotalcalculationlegs.Value
  Reached Here   - Other Script has reached text changed.
  0                        -Returned value of Initialtotalcalculationlegs

Any help is appreciated.

1 answer

✓ Accepted answer

If the GUI is not visible, change the pathway to:

script.Parent.MouseButton1Click:Connect(function()
game.StarterGui.MainMenu.Parent = --player who clicked
end()

1 comment

0

You are targeting the startergui, but the gui is actually in the PlayerGui

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