Please someone help me why this things is not working well. I am trying my best but i dont know how to fix it. Thank you :D
--//Starterpack Local Script\\--
repeat wait() until game.Players.LocalPlayer.Character
local player = game.Players.LocalPlayer
local userinputservice = game:GetService("UserInputService")
local char = player.Character
local leaderstats = game:GetService("ServerScriptService"):WaitForChild("leaderstats")
userinputservice.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://04480814830"
local PlayAnim = char.Humanoid:LoadAnimation(anim)
PlayAnim:Play()
leaderstats.power.Value = leaderstats.power.Value + 1
wait(3)
end
end)
And this is my Leaderstats.
--//ServerScriptService Script\\--
local dsService = game:GetService("DataStoreService")
local ds = dsService:GetDataStore("PowerStats") --
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "leaderstats"
local power = Instance.new("IntValue", folder)
power.Name = "Pow"
power.Value = ds:GetAsync(plr.UserId) or 0
power.Changed:Connect(function()
ds:SetAsync(plr.UserId, power.Value)
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync(plr.UserId, plr.leaderstats.Money.Value)
end)

3 comments
What’s not working...?
^ Doesn't seem to be an error with UserInputService. Probably the code within the event.
did you make the animation you're using?