Giving value to IntValue not working

local text = script.Parent.Text
local box = script.Parent
local Value = script.Parent.Parent.Parent.Parent.EconomySeats.Value 
local context = game:GetService("ContextActionService")
if box.FocusLost  then
	Value = text
end

my code

How do I fix this?

1 Like

Your error lies with this:

You aren’t setting the value,You’re setting the variable, to set the value of the Instance you say:

if box.FocusLost  then
	Value.Value = text
end

Extra tips:
If you’re using an Intvalue then make sure the value has no decimals, Intvalues don’t use decimals.
If you wanted to use decimals, then use number values instead, but be warned, they aren’t always the number you put them as, but they’re pretty close it, so it doesn’t matter all that much
If you need them to be the EXACT number you put them as, use a string value and use the function tostring() to set it and use the function tonumber() getting it back
Example:

--getting
local number = tonumber(myvalue.Value)
--setting
local newnum = tostring(number)
myvalue.Value = newnum

The value is still not changing

I forgot to tell you that box.FocusLost is not a variable, it’s an Event

Honestly, I had to take a second look at your code, and it scares me, You have like 2 error in this code, and it’s only 7 lines long, because of this, I worry the rest of your code is…um… riddled with bugs, are you new to roblox’s lua?

Yea it has been around 1-3 months since I have started

Can you tell me what is this? Is this a leaderstat Value?

If it is then consider changing it to…

local player = game.Players.LocalPlayer
local leaderstat = player.leaderstat
local ValueNum = leaderstat.EconomySeats
local box = script.Parent
local context = game:GetService("ContextActionService")

box.FocusLost:Connect(function()
    ValueNum.Value = "".. box.Text ..""
end)

I see, well, could you give us more details so we can help you better?
Because I’m very confused with the amount of details you’ve provided…

Also, if it’s not giving a Value. Consider changing this to a LocalScript, because TextBox doesn’t update in Server Script.
I just thought you are using a Server Script not a LocalScript.

1 Like

Are you using Local Script or Script?

1 Like

This is a int value and I am trying to assign it a value from the player and then convey it to it

First I was using a normal script but then I changed to local script and am using a remote event

when the change IntValue Value it on Script or LocalScript?

i think on “local text = script.Parent.Text” you need to change into when “if box.FocusLost then”

I am using a script in serverscript service to try and change it

Normal scripts are used for the server, and local scripts are used for the client, if you’re using a value that is supposed to be visible on the client, then it’s best to use a local script, but if it’s supposed to be visible to everyone, you must use both and connect them using a RemoteEvent/RemoteFunction

Yea thats why I am using both and a remote event

alright well, if you edited your code and it still didn’t work, send me what you’ve got so far, server and client please