NumberValue not changing accordingly to TextBox

Basically, I am making something where you put a number in a text box, click submit, then it changes a player’s numbervalue to the number in the textbox but it isn’t working.

Server Code:

game.ReplicatedStorage.arrestEvent.OnServerEvent:Connect(function(plr, reason, arrestTime, target)
	local detainee = game.Players:FindFirstChild(target)
	detainee.jailTime.Value = arrestTime
end)

Client Code:

script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.Text == "SAVE" then
		script.Parent.Parent.reasonText.Text = "REASON: "..script.Parent.Parent.arrestReason.Text
		script.Parent.Parent.arrestTime.Text = "ARREST TIME: "..script.Parent.Parent.arrestTimeText.Text
		script.Parent.Text = "CONFIRM"
	else
		if script.Parent.Text == "CONFIRM" then
			game.ReplicatedStorage.arrestEvent:FireServer(script.Parent.Parent.arrestReason.Text, script.Parent.Parent.arrestTime.Text, script.Parent.targetName.Value)
		end
	end
end)

I have finally figured it out.

what is the answer? I’m doing it the other way round. When the script changes the number value, the text in the textbox changes, but it keeps the text in the textbox the same. So if the number value is 0, and i change it to 5, the textbox still says zero. In the script it’s an infinite loop of checking but it never works. Do you have any idea?

script:

local Statisctic = script.Parent.Parent.Parent.Money
local Money = script.Parent.Money

repeat

	Statisctic.Text = Money.Value
	wait(0.1)
	
	
until 1 == 2
1 Like