here is the first script(its in serverscriptservice)
PowerData = game:GetService("DataStoreService"):GetDataStore("PowerData")
RebirthsData = game:GetService("DataStoreService"):GetDataStore("RebirthsData")
game.Players.PlayerAdded:Connect(function(plr)
local LB = Instance.new("IntValue")
LB.Name = "leaderstats"
LB.Parent = plr --data store script/leader stats script
local p = Instance.new("IntValue")
p.Name = "Power"
p.Parent = LB
p.Value = PowerData:GetAsync(plr.userId) or 0
local r = Instance.new("IntValue")
r.Name = "Rebirths"
r.Parent = LB
r.Value = RebirthsData:GetAsync(plr.userId) or 0
end)
game.Players.PlayerRemoving:Connect(function(plr)
PowerData:SetAsync(plr.userId,plr.leaderstats.Power.Value)
RebirthsData:SetAsync(plr.userId,plr.leaderstats.Rebirths.Value)
end)
here is the second script(its in starter player scripts)
local Player = game.Players.LocalPlayerscript.Parent.LeftHand.Touched:connect(function(hit)
if hit.Parent.Humanoid and dmg == true then
hit.Parent.Humanoid:TakeDamage(20)
local Mouse = Player:GetMouse()
local dmg = true
Mouse.KeyDown:connect(function(key) --punch script
if key == "q" then
local an = script.Parent.Humanoid:LoadAnimation(script.Animation)
an:Play()
dmg = false
wait(1)
dmg = true
wait(2)
end
end)
end
end)
