Attempt to index nil with 'GetPropertyChangedSignal'

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

  1. What do you want to achieve? Keep it simple and clear!

I am trying to write a script that will resize the player via a textbox input.

  1. What is the issue? Include screenshots / videos if possible!

The script I made encounters an error when I call a function with a “GetPropertyChangedSignal” trigger and I have no Idea why.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked extensively online but all the things I found were just caused by misspelled variables or misvalued variables. I can confirm that I have neither of these problems.

Code below:

local players = game:GetService("Players") --This service is the Players service, basically it handles things involving players

local player = game:WaitForChild("Players").LocalPlayer

print(player)

local character = player.CharacterAdded:Wait() --This is where you put the character that will do the touching

print(character)

local textbox = player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("TextBox")

local textboxtext = player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("TextBox").Text.Value

print(textbox)

local sizeHi = character.Humanoid.BodyHeightScale.Value
local sizeW = character.Humanoid.BodyWidthScale.Value
local sizeD = character.Humanoid.BodyDepthScale.Value
local sizeHe = character.Humanoid.HeadScale.Value
local sizeHiperm = character.Humanoid.BodyHeightScale.Value
local sizeWperm = character.Humanoid.BodyWidthScale.Value
local sizeDperm = character.Humanoid.BodyDepthScale.Value
local sizeHeperm = character.Humanoid.HeadScale.Value

print(sizeHiperm)

print(sizeHi)

local function changethesize()
	if tonumber(textbox) ~= nil then

		sizeHi.Value = sizeHiperm.Value * tonumber(textbox)

	end

	print(tostring(sizeHi))
	print(tonumber(tostring(textbox)))
	print(tostring(textbox))
	print(tostring(textbox))
end

textboxtext:GetPropertyChangedSignal("Text"):Connect(changethesize)

Any help would be appreciated, as I am new to scripting. Thank you.

these are referencing the same instance, hence variables exist ( this goes with pretty much every variable you just put above referencing the same instances)

local textbox = player.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("TextBox")

local textboxtext = textbox.Text.Value

now here, perhaps you mistaken this as the textbox itself vvv

textbox:GetPropertyChangedSignal("Text"):Connect(changethesize) --

It doesn’t error anymore, but now it’s not registering changes in the textbox. When I type something, the print statements output nothing.

check what exactly is this textbox instance, is it a TextBox in a Frame or is textbox a StringValue because if its a stringvalue the only property it detect changes is its Value property so you have to replace the line with this

textbox.Changed:Connect(changethesize)
-- or 
textbox:GetPropertyChangedSignal("Value"):Connect(changethesize) -- Not good, save your time

getpropertychangedsignal is best used with instances with multiple properties like a part’s color, size etc

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.