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…