What do you want to achieve? I want to have a saving head growth leaderstat where it puts the size of the head on the leaderstat
What is the issue? I simply cannot do it
What solutions have i tried so far? I have tried Using profileService and watching alvinblox tutorials
local HeadSize = 10000000000000000000
local SpeedOfScaling = 0.0003
local I = 1
local X = 0
local function check(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Humanoid.HeadScale.Value == 1 then
if X == 0 then
X = 1
I = 1
while I <= HeadSize do
wait(0.01)
hit.Parent.Humanoid.HeadScale.Value = I
I = I+SpeedOfScaling
end
while X == 1 do
X = 0
wait(0.01)
end
end
end
end
end
script.Parent.Touched:connect(check)
I am using profileservice, I have the leaderstat, but it just stays at 0
Create a folder inside the player called "leaderstats" and any values inside that folder will show up on the leaderboard. To get the size of the head you could say Character.Head.Size.Magnitude.
Looking into it, I’m not sure I can help you with saving data, I’ve never done anything with that. But I can help you with just making the leaderstat value change.
Also Humanoid.HeadScale.Value only works for R15, if you want a global rigtype option you can say Character.Head.Size.Magnitude.
Use a changed signal event to get the size of the head and then change the value.
and also just make sure to set the value before adding this because the value will only change when the characters head size changes, meaning it will stay at zero until the players head size has changed.
Put it in the PlayerAdded event. If you only use R15 in your game then it’s fine to use Humanoid.HeadScale.Value, because there are several values inside the humanoid’s of R15 RigType models representing body scale which are useful if you ever wanted to make something like a body scaler like in Robloxian Highschool. I hope one day Roblox will add body scale value’s for R6 RigTypes but I doubt that’ll ever happen as Roblox is aiming to make Rthro types more popular.
You will first need to get the player using Players:GetPlayerFromCharacter(hit.Parent). If it exists, you should go into the leaderstats and set it to the value of the HeadScale. Simple.
I can also help you with saving data, if you need that as well.
You want the leaderstats to affect all players who join right? Use a PlayerAdded event, I have no idea what the “ProfileService” is, I’ve honestly never heard of it and don’t know how you could be using it to add leaderstats. The “HeadSizeValue” is the integer value (or float, whichever you choose) inside the leaderstats folder representing what size the characters current head size is.
edit:
ACTUALLY now that I’ve come to look further into this, I’ve realised .Changed and :GetPropertyChangedSignal"" don’t work for detecting a change in head size for whatever reason, the only changed signal event I could receive is “parent”. However I’ve come to know that both methods will work for value instance. So if you structure the event like this it will work.
local Players = game:GetService"Players"
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local LeaderStats = Instance.new("Folder", Player)
LeaderStats.Name = "leaderstats"
local HeadSize = Instance.new("NumberValue", LeaderStats)
HeadSize.Value = Character.Head.Size.Magnitude
local Value = Instance.new("NumberValue")
Value:GetPropertyChangedSignal"Value":Connect(function(Property)
HeadSize.Value = Character.Head.Size.Magnitude
end)
spawn(function()
while true do task.wait()
Value.Value = Character.Head.Size.Magnitude
end
end)
end)
end)