Customizing a players scale globally (server-side)

Based off of the title, I have a GUI that takes strings and converts them to number values (if possible). These number values will be used to set the player’s height scale. I have done this successfully but only on the client-side. I now want to make it server-side so all players can see the affected player’s new scale size.

My issue is, well, the script isn’t giving me errors or anything to help me debug it. This has made it very challenging to determine the problem.

I’ve tried using a remote event (client → server) to tell the server to update the player’s scale. This is where the script “dies” and does nothing when a value is input into the textbox on the Gui.

Here’s the first way I tried:

--Local Script

local height_Textbox = script.Parent.Menu.HeightTextBox

local replicated_Storage = game:GetService("ReplicatedStorage")
local heightSizeRE = replicated_Storage:WaitForChild("Call_Height_Size") --Remote Event

heightSizeRE:FireServer()



--Script

local replicated_Storage = game:GetService("ReplicatedStorage")

local heightSizeRE = replicated_Storage:WaitForChild("Call_Height_Size")

local function HeightTextChanged(plr)
	local height_Textbox = plr.PlayerGui.AdminSizeMenu.Menu.HeightTextBox
		height_Textbox:GetPropertyChangedSignal("Text"):Connect(function()
		local height_Input = height_Textbox.Text
			if tonumber(height_Input) then --If the input text is capable of converting to a number then...
				if tonumber(height_Input) > 100 then --If the value is greater than 100 then set the value to 100
					height_Input = ("100")
				end
				if tonumber(height_Input) < 0.3 then --If the value is less than 0.3 then set the value to 0.3
					height_Input = ("0.3")
				end
				plr.Character.Humanoid.BodyHeightScale.Value = height_Input --Set the scale to the value the player inputted
			end
		end)

heightSizeRE.OnServerEvent:Connect(HeightTextChanged)

Now here’s the other way I tried:


--Local Script

local height_Textbox = script.Parent.Menu.HeightTextBox

local replicated_Storage = game:GetService("ReplicatedStorage")
local heightSizeRE = replicated_Storage:WaitForChild("Call_Height_Size") --Remote Event

height_Textbox:GetPropertyChangedSignal("Text"):Connect(function()
	heightSizeRE:FireServer()
end)



--Script

local replicated_Storage = game:GetService("ReplicatedStorage")

local heightSizeRE = replicated_Storage:WaitForChild("Call_Height_Size")

local function HeightTextChanged(plr)
	local height_Textbox = plr.PlayerGui.AdminSizeMenu.Menu.HeightTextBox
	local height_Input = height_Textbox.Text
			if tonumber(height_Input) then --If the input text is capable of converting to a number then...
				if tonumber(height_Input) > 100 then --If the value is greater than 100 then set the value to 100
					height_Input = ("100")
				end
				if tonumber(height_Input) < 0.3 then --If the value is less than 0.3 then set the value to 0.3
					height_Input = ("0.3")
				end
				plr.Character.Humanoid.BodyHeightScale.Value = height_Input --Set the scale to the value the admin inputted
			end
end

I have four settings which include: height, depth, width, and head scale. I’ve provided the code only for the height scale so this is easier to read.

I need to know if I’m doing something wrong here or if there is a better way to accomplish this. Thanks for reading.

Both ways I’ve provided above do nothing…

Hello! It seems you’re trying to find what’s written on the PlayerGui Textbox on the server, but that won’t work since the text changed on the client not on the server.

When you’re firing the remotevent you should put the Text as an argument so you don’t have to check it on the server.

height_Textbox:GetPropertyChangedSignal("Text"):Connect(function()
	heightSizeRE:FireServer(height_Textbox.Text)
end)
local function HeightTextChanged(plr, Text)

To understand better take a look at this:

Everytime I click the part I print the Text at the TextBox from the server, even though I changed it on the client you’ll see It’s printing the exact same thing on the server.

1 Like

Man, you’re a genius. I appreciate the help.

1 Like