local ds = game:GetService("DataStoreService"):GetDataStore("MySpeed") game.Players.PlayerAdded:Connect(function(player) local key = "Speed-"..player.UserId local folder = player:WaitForChild('leaderstats') local int = Instance.new("IntValue",folder) int.Name = "?Speed?" int.Value = 16 local save = ds:GetAsync(key) if save then int.Value = save end repeat int.Changed:Connect(function() ds:SetAsync(key,int.Value) end) wait(15) until player == nil if player.Character then warn("Character!") player.Character.Humanoid.WalkSpeed = int.Value end game.Players.PlayerRemoving:Connect(function() ds:SetAsync(key,int.Value) end) end)
Sorry for B A D I N D E N T A T I O N, #StackEdit did this. It Runs :GetAsync(It gets the data) but my Humanoid WalkSpeed doesn't increase. Even though I get speed. [and I also did the CharacterAdded method.]
Please do not post 'Bad Indentation' in the comments. Any Ideas?
I think your problem lies here. You do not need this repeat or wait(15), the .Changed event will always stay connected to the function until you disconnect it. Furthermore player will never be nil so your script will never get to the character part.
repeat int.Changed:Connect(function() ds:SetAsync(key,int.Value) end) wait(15) until player == nil
All you really need to do is edit the above to look more like this,
int.Changed:Connect(function() ds:SetAsync(key,int.Value) end) -- Character stuff here