Help changing a numbervalue using a textbox

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? So I wanna know how to fix my script,

Local Script:

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

script.Parent.FocusLost:Connect(function()
	Event:FireServer(script.Parent.Text)
end)

Script:

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

Event.OnServerEvent:Connect(function(player, amount)
	player.PlayerGui.Settings.ViewBobbing:WaitForChild("GENERAL_DAMPING_VAL").Value = tonumber(amount)
end)

I am trying to set the number on a textbox so the numbervalue’s value changes.

  1. What is the issue? It doesn’t work. It doesn’t have any errors though.

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes, I did look but it seems all of those doesn’t work.

Does it change? Does it print something? Your code logic seems good.

It doesn’t work, yet it does work when I print the amount.

Try sending the value from the client to server instead making a directory on the server so

local

event:FireServer(NumberValue,Amount)

server

event.OnServerEvent:Connect(function(Player,NumberValue,Amount)
NumberValue.Value = Amount
end)

Still doesn’t work.

Local

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local Val = script.Parent.Parent.Parent.ViewBobbing:WaitForChild("GENERAL_DAMPING_VAL")

script.Parent.FocusLost:Connect(function()
	Event:FireServer(Val,script.Parent.Text)
end)

Server

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

Event.OnServerEvent:Connect(function(player, val, amount)
	val.Value = amount
end)

Doesn’t have any errors either.

Strange. The code logic is good. Try printing it like

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

Event.OnServerEvent:Connect(function(player, val, amount)
	print(val.Value,amount)
	val.Value = amount
	print(val.Value,amount,val.Value == amount) -- The 3rd thing is a boolean if val.Value == amount then.
end)

The print seems to be working, just the print. It doesn’t change the number val

WAIT show me the output.

Screenshot 2022-07-14 125002

ok i got it why is says false… Try seeing the value on the server if its == 11. Because then I can prove my hypothesis. That a script is changing it.

Now it only says this:

Screenshot 2022-07-14 125843

Server:

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

Event.OnServerEvent:Connect(function(player, val, amount)
	print(val.Value,amount)
	val.Value = tonumber(amount)
	if val.Value == 11 then
		return
	else
		print(val.Value,amount,val.Value == amount)
	end
end)

no no no not like that. I mean check it by switching to server.

Go to the Home Tab WHILE PLAYING → Current: Client click that.

Already tried that, it still says 0.75 (the default)

My brain is broken now. That can only mean 1 THING. There is another script in there changing it. I Guarantee

lol just remove tonumber n just put number, number value does not support letters so if its letters it returns nil

There isn’t any, the parent of that number value is a local script
and this is its parent:

local GENERAL_DAMPING_VAL = script:WaitForChild("GENERAL_DAMPING_VAL")
local TILT_DAMPING_VAL = script:WaitForChild("TILT_DAMPING_VAL")
local OFFSET_DAMPING_VAL = script:WaitForChild("OFFSET_DAMPING_VAL")

local GENERAL_DAMPING = GENERAL_DAMPING_VAL.Value -- Higher number equals less bob
local TILT_DAMPING = TILT_DAMPING_VAL.Value -- Higher number equals less tilt
local OFFSET_DAMPING = OFFSET_DAMPING_VAL.Value -- Higher number equals less camera offset bobbing

What you said didn’t work for me

fixed.rbxm (5.4 KB)
Here is a file that what i explained worked.

or you can do.

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

Event.OnServerEvent:Connect(function(player, val, amount)
	val.Value = tonumber(amount) or 0.75
end)

what I did was easier, tonumber is unnecessary. if you put any letter, it will return as 0 or nil