Ninjakiwiw
(Ninjakiwiw)
December 20, 2020, 4:23am
#1
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
Synteuro
(Synteuro)
December 20, 2020, 4:27am
#2
Are you sure? What is p.Char? Maybe p.Char.Height is nil, how are you checking if it changed?
1 Like
Ninjakiwiw
(Ninjakiwiw)
December 20, 2020, 4:29am
#3
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
Synteuro
(Synteuro)
December 20, 2020, 4:30am
#4
Okay and where do you check? Is it in a localscript or a normal script?
Ninjakiwiw
(Ninjakiwiw)
December 20, 2020, 4:33am
#5
The code is located inside a local script.
Synteuro
(Synteuro)
December 20, 2020, 4:35am
#6
Can you show the code where you check the values?
Synteuro
(Synteuro)
December 20, 2020, 4:37am
#8
I said where you check the values, not where you make them. Also PlayerAdded has 1 parameter not 2.
Equistonic
(Equistonic)
December 20, 2020, 4:39am
#10
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
Synteuro
(Synteuro)
December 20, 2020, 4:40am
#11
Uhm… you said you check the values in another script, can you show the code of where you check the values?
Synteuro
(Synteuro)
December 20, 2020, 4:40am
#12
He said char is a folder not the character.
Equistonic
(Equistonic)
December 20, 2020, 4:40am
#13
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
Ninjakiwiw
(Ninjakiwiw)
December 20, 2020, 4:47am
#15
I may of confused myself with something else, I check the value via clicking on the Height and Width value located in the player.
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)
Synteuro
(Synteuro)
December 20, 2020, 4:48am
#16
Print the values when you change them.
Ninjakiwiw
(Ninjakiwiw)
December 20, 2020, 4:50am
#17
I left out alot of stuff, I’ll try to include everything the next time I need help, sorry for that.