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
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
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?
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)
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.
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