local r = game:GetService("ReplicatedStorage"):WaitForChild("Sword")
r.OnServerEvent:Connect(function(Player, val)
local character = workspace:WaitForChild(Player.Name)
if val == "Slash" then
local a = Instance.new("Animation", character)
a.Name = ("Slash")
a.AnimationId = "rbxassetid://5713765649"
local a1 = character:WaitForChild("Humanoid"):LoadAnimation(a)
a1:Play()
----- damage and recognize scripts
local findTool = character:FindFirstChild("Sword")
if findTool then
findTool.Blade.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum.Parent.Name ~= Player.Name and not hit.Parent:FindFirstChild("AlreadyHit") then
local f = Instance.new("IntValue", hum.Parent)
f.name = "AlreadyHit"
game.Debris:AddItem(f,5)
hum:TakeDamage(math.random(100,100))
wait(1)
hum.WalkSpeed = 15
hum.JumpPower = 50
end
end
end)
end
wait(1)
a1:Stop()
a:Destroy()
end
end)
COMMUNITY QUESTION
The sword script does not do damage when Slashing?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.
