Lol
Anyways to the animation first open roblox studio then you make a game. After you go and make the game go to view and open Explorer, and put this script in the Serverscriptservice local RStorage = game:GetService("ReplicatedStorage")
local Remotes = RStorage:WaitForChild("Remotes")
local Punch = Remotes:WaitForChild("Punch")
local Connection
local function DealDamage(Part)
local Character = Part.Parent
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
Humanoid:TakeDamage(20)
Connection:Disconnect()
end
end
local function PlayerPunch(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local RightHand = Character:WaitForChild("RightHand")
Connection = RightHand.Touched:Connect(DealDamage)
wait(0.5)
Connection:Disconnect()
end
Punch.OnServerEvent:Connect(PlayerPunch)
Next put this script local Players = game:GetService("Players")
local RStorage = game:GetService("ReplicatedStorage")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Remotes = RStorage:WaitForChild("Remotes")
local Punch = Remotes:WaitForChild("Punch")
local Mouse = Player:GetMouse()
local Animation = script:WaitForChild("Animation")
local CanDamage = true
Mouse.KeyDown:connect(function(Key)
if Key == "f" then
if CanDamage then
CanDamage = false
local Humanoid = Character:WaitForChild("Humanoid")
local PunchAnimation = Humanoid:LoadAnimation(Animation)
PunchAnimation:Play()
Punch:FireServer()
wait(1)
CanDamage = true
end
end
end)
If you want a stat system open explorer and it is in the view tab then go and put this script in to replicatedstorage so the stat system will work there might be a few bugs though.
local players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DataStore = game:GetService("DataStoreService")
local statsFolder = ReplicatedStorage:WaitForChild("stats")local data = {
["attack"] = DataStore:GetDataStore("attack"),
["strength"] = DataStore:GetDataStore("strength")
}
local default = {
["attack"] = 16,
["strength"] = 1
}players.PlayerAdded:connect(function(player)
local userId = player.userId
local stats = Instance.new("Folder")
stats.Name = player.Namelocal attack = Instance.new("IntValue")
attack.Name = "attack"
attack.Value = data["attack"]:GetAsync(userId) or default["attack"]local strength = Instance.new("IntValue")
strength.Name = "strength"
strength.Value = data["strength"]:GetAsync(userId) or default["strength"]attack.Parent = stats
strength.Parent = stats
stats.Parent = statsFolder
end)players.PlayerRemoving:connect(function(player)
local userId = player.userId
local stats = statsFolder:FindFirstChild(player.Name)
data["attack"]:SetAsync(userId, stats.attack.Value)
data["strength"]:SetAsync(userId, stats.strength.Value)
end)
I am just getting stressed to the point by the way so y'all Don't have to wait so ya
YOU ARE READING
How to code
AksiThis is a book on how to code in roblox this also shows some animations you can make like punch animations