Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Avatar Scaling / data store not working?

Asked by 6 years ago

Today I was testing my project and I was adding saving player scale. I did a testing server with a few friends and I noticed when they reset, died or left and rejoined, their size would increase dramatically. I’m not sure what is causing this issue, I’ve looked into it and can’t find anything that would increase the size with-out a player activating the tool or the script changing the scale by force.

If you can help then I would appreciate it! Also include what I'm doing wrong.

DataStore script:

001local Data = game:GetService("DataStoreService"):GetDataStore("I")
002 
003game:GetService("Players").PlayerAdded:Connect(function(Plr)
004 
005    --  // Leaderstats
006 
007    local Stats = Instance.new("Folder", Plr)
008    Stats.Name = "leaderstats"
009 
010    local Strength = Instance.new("IntValue", Stats)
011    Strength.Name = "Strength" 
012 
013    local Rebirths = Instance.new("IntValue", Stats)
014    Rebirths.Name = "Rebirths"
015 
View all 102 lines...

Tool local script:

01local Tool = script.Parent
02local Player = game:GetService("Players").LocalPlayer
03local Animation = Tool:WaitForChild("Handle").Animation
04local Liftable = false
05local UIS = game:GetService("UserInputService")
06local LastActivated = tick()
07 
08function Check()
09    if Liftable == true then
10        UIS.InputBegan:Connect(function(Input, GPE)
11            if GPE then
12                return
13            end
14 
15            if Input.KeyCode == Enum.KeyCode.E and Liftable == true then
View all 59 lines...

Tool Server script:

01local Tool = script.Parent
02 
03Tool.Fire.OnServerEvent:Connect(function(Player, Check)
04    wait(0.1)
05    Player.leaderstats.Strength.Value = Player.leaderstats.Strength.Value + 1
06    Player.Scales.BWS.Value = Player.Scales.BWS.Value + 0.2
07    Player.Scales.BHS.Value = Player.Scales.BHS.Value + 0.1
08    Player.Scales.BDS.Value = Player.Scales.BDS.Value + 0.2
09    Player.Character:FindFirstChild("Humanoid").BodyWidthScale.Value = Player.Character:FindFirstChild("Humanoid").BodyWidthScale.Value + 0.03
10    Player.Character:FindFirstChild("Humanoid").BodyHeightScale.Value = Player.Character:FindFirstChild("Humanoid").BodyHeightScale.Value + 0.02
11    Player.Character:FindFirstChild("Humanoid").BodyDepthScale.Value = Player.Character:FindFirstChild("Humanoid").BodyDepthScale.Value + 0.03
12end)
0
Your event UserInputService event is inside a function, which is not okay. User#19524 175 — 6y

Answer this question