Change a string value to the Textbox text, when pressing a TextButton

Hello, im making a custom kaioken script to my Dragon Ball Z game.
How high is the number, less is the lightemission of the kaioken aura.
But the Textbox doesn’t change the Stringvalue’s value and i dont know why
Can you help me with it please?

local Textbox = script.Parent.Parent.kaiomult

		script.Parent.Value.Value = Textbox.Text
		local val = script.Parent.Value.Value
		local kaio = val * 0.05
		local auras = game.ReplicatedStorage.MorphObjects.Auras.kaiokentechnique.LightEmission
		game.ReplicatedStorage.MorphObjects.Auras.kaiokentechnique.LightEmission = auras - kaio

You should be using the FocusLost event:


Focus lost runs when the player stops focusing on the textbox(meaning that their mouse clicked outside of the textbox). Your code only works when the player clicked the textbox, and it won’t update because you only changed the value when they clicked the textbox, which doesn’t have text in it yet.

It only works when the player clicks in a button bro

Is it a server script or a local script?

local script, because it should be more intense only for that player (the other players will see the more intense aura of him but it will only work to him)

this would infinitely loop, he wants it from a button

1 Like

So you’re trying to make a StringValue be equal to the text of a TextBox? And I assume it’s the one right here:

Are there any errors?

1 Like

There could be a potential problem with this, and anywhere else you use it. Because the script could be getting confused with .Value.Value, as it’s the way to find the value of an object, and it seems the name of one of them. So I’d say change the name to something else to make sure it’s not messing it up.


ok thanks gonna test it and if it works i tell you :slight_smile:

bro, this still not working. i changed the name, changed the scripts too, changed the place and changed the scripts too

Could you perhaps show us a screenshot of the explorer where the script and all of that is?

And are those print()'s showing up in the output when you click whatever “script.Parent” is? (I assume it’s a button, as you’re using MouseButton1Click) To see if the problem is with the Touched event or with what’s inside it.

Sorry for the added trouble, but where’s the script and the button in the Explorer? Could you expand them to see the rest of the objects? Thanks.

1 Like

oh i found the solution thanks

1 Like

Oh, okay nice! May I ask what the solution was? I’m trying to use helping others as a way to learn as well. Good to know I helped in some way though, and glad it worked out.

Yo, post the solution, I’m also facing the same problem.

use tonumber()
i multiplied a string instead of a integer lol