Trouble with TextBoxes and RemoteEvents

Hi, I am Fleble. I am trying to make a gravity changer for my admin panel. Although for some reason the text I am sending through a Remote Event to the server does not get sent properly. I hope someone could help me.
I only recently learned how to use RemoteEvents, so I don’t know what to do.
In both the local script and the server script I printed out the text, they should both be the same, but they aren’t.
I put some comments in my script so you know why I put that there.
My scripts are down below:

The LocalScript:

local Player = game.Players.LocalPlayer

local textbox = script.Parent

textbox:GetPropertyChangedSignal("Text"):Connect(function()
	textbox.Text = textbox.Text:gsub("%D+", ""); -- Makes sure only numbers can be typed
end)

script.Parent.FocusLost:connect(function(enterPressed)
	if enterPressed then
		game.ReplicatedStorage.ChangeGravity:FireServer(Player,script.Parent.Text) -- Sending the text and player to the Server
		print("Client "..tostring(script.Parent.Text)) -- Printing the text on the Client
	end
end)

The ServerScript:

game.ReplicatedStorage.ChangeGravity.OnServerEvent:Connect(function(Player,text) -- I included Player because I will add a System Message that includes their name
	game.Workspace.Gravity = tonumber(text) -- Changing the gravity to the text
	print("Server "..tostring(text)) -- Printing the text on the Server
end)

The output:
image

I have been stuck not being able to fix this for a few days.

If you need more information, please let me know.
Thanks for your help in advance.

It’s because you’re passing player as a parameter on the client. The player is passed automatically on the client so you only need it as a parameter on the server.

It will work now:

script.Parent.FocusLost:connect(function(enterPressed)
	if enterPressed then
		game.ReplicatedStorage.ChangeGravity:FireServer(script.Parent.Text) 
	end
end)
1 Like

Wow, it works! Thank you so much!