Value not working?

Thanks for stopping by,
Whenever I reference a value located in a folder created in the player (Char) it just does not change. It comes up with no error message but it just does not change. (The code is written in a local script)

Code:

p = game:GetService("Players").LocalPlayer
c = p.Character
button = script.Parent

height = p.Char.Height
width = p.Char.Width

button.MouseButton1Click:Connect(function()
	
	height.Value = 0.97
	width.Value = 0.9

end)  
1 Like

Are you sure? What is p.Char? Maybe p.Char.Height is nil, how are you checking if it changed?

1 Like

Char is a folder I’ve created via another script. I check if it’s changed by accessing players then the player, the char folder and the value inside.

1 Like

Okay and where do you check? Is it in a localscript or a normal script?

The code is located inside a local script.

Can you show the code where you check the values?

image

(Normal Script)

I said where you check the values, not where you make them. Also PlayerAdded has 1 parameter not 2.

Sorry, 'bout that
image

I recommend making using local for your variables, so this is what I mean:

local p = game:GetService("Players").LocalPlayer
local c = p.Character

local height = p.Char.Height
local width = p.Char.Width

button.MouseButton1Click:Connect(function()

    height.Value = 0.97
    width.Value = 0.9

end)  

Let me know if this works or if you need anything else!

1 Like

Uhm… you said you check the values in another script, can you show the code of where you check the values?

He said char is a folder not the character.

Yes, I just noticed. I was righting my reply while he showed that. My apologies.

The values do update, it’s just that IntValues can only contain whole numbers, so you should consider switching to NumberValues.

1 Like

I may of confused myself with something else, I check the value via clicking on the Height and Width value located in the player.
image
The Char folder is created from a script located in the server script storage

game.Players.PlayerAdded:connect(function(plr,pose)

	char = Instance.new("Folder")
	char.Parent = plr
	char.Name = "Char"			
	
	height = Instance.new("IntValue")
	height.Parent = char
	height.Value = 1.05
	height.Name = "Height"
	
	width = Instance.new("IntValue")
	width.Parent = char
	width.Value = 1
	width.Name = "Width"

	
end) 

I attempt to change the value through the local script.

p = game:GetService("Players").LocalPlayer
c = p.Character
button = script.Parent

height = p.Char.Height
width = p.Char.Width

button.MouseButton1Click:Connect(function()
	
	height.Value = 0.97
	width.Value = 0.9

end)  

Print the values when you change them.

I left out alot of stuff, I’ll try to include everything the next time I need help, sorry for that.