For some reason slashing literally happens TOO soon. If i put it on 0.4 or less instant stop-- it stops working.
I’ve tried everything. But the player can just touch it and then boom, free star
Code:
katana = game.ReplicatedStorage.Katana
class = Instance.new
tables = {
anim = {
11906979696; --Slash1
11906982618; --Slash2
11906984334; --Slash3
11906986139; --Slash4
}
}
slashCombo = 0
slashing = false
baseID = "rbxassetid"
function kill(i)
i:Destroy()
end
katana.Remotes.Swinged.OnServerEvent:Connect(function(player: Player)
local character:Model = player.Character or player.CharacterAdded:Wait()
local humanoid:Humanoid = character:WaitForChild("Humanoid")
local hrp:Part = character:WaitForChild("HumanoidRootPart")
local animator:Animator = humanoid:WaitForChild("Animator")
local animation:Animation = Instance.new("Animation")
local torso:Part = character:WaitForChild("Torso")
local sound = katana.Sounds['Sword Swing']:Clone()
sound.Parent = workspace
sound:Play()
sound.Ended:Connect(function(soundId: string)
sound:Destroy()
end)
if slashCombo == 0 then
animation.AnimationId = baseID.."://"..tables.anim[1]
animator:LoadAnimation(animation):Play()
slashCombo = 1
elseif slashCombo == 1 then
animation.AnimationId = baseID.."://"..tables.anim[2]
animator:LoadAnimation(animation):Play()
slashCombo = 2
elseif slashCombo == 2 then
animation.AnimationId = baseID.."://"..tables.anim[3]
animator:LoadAnimation(animation):Play()
slashCombo = 3
elseif slashCombo == 3 then
animation.AnimationId = baseID.."://"..tables.anim[4]
animator:LoadAnimation(animation):Play()
slashCombo = 0
end
local slash = katana.Assets.Slash:Clone()
slash.Parent = workspace.Fx
local slashweld = class("Weld", character)
slashweld.Name = "SlashWeld"
slashweld.Part0 = torso
slashweld.Part1 = slash
slashweld.C0 = CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0,math.rad(90),0)
local tweenService = game:GetService("TweenService")
local tween = tweenService:Create(slash, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {["Transparency"] = 1})
tween:Play()
local tween2= tweenService:Create(slash["Outer Mesh"], TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {["Scale"] = Vector3.new(12, 6,12)})
tween2:Play()
local tween3= tweenService:Create(slash["Inner Crescent"]["Inner Mesh"], TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {["Scale"] = Vector3.new(12, 6,12)})
tween3:Play()
local tween4= tweenService:Create(slash["Inner Crescent"], TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {["Transparency"] = 1})
tween4:Play()
tween.Completed:Connect(function(playbackState: Enum.PlaybackState)
slash:Destroy()
slashweld:Destroy()
end)
humanoid.Jumping:Connect(function(active : boolean)
if active == true then
if slashing == true then
local position = class("BodyPosition", hrp)
position.Position = hrp.Position
position.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
task.wait(0.2)
position:Destroy()
end
end
end)
if slashing == true then
local blade = script.Parent.Blade
blade.Touched:Connect(function(enemyPart: BasePart)
local fullEnemy = enemyPart.Parent
local humanoid = fullEnemy:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:TakeDamage(1)
end
local blocking = fullEnemy:FindFirstChild("Blocking")
if blocking then
if blocking.Value == true then
local hrp = fullEnemy:FindFirstChild("HumanoidRootPart")
local goofy = class("Attachment",hrp)
goofy.Name = "att"
local hit = katana.Fx.blockhit:Clone()
hit.Parent = goofy
hit:Emit(1)
end
end
end)
end
katana.Remotes.Blocking.OnServerEvent:Connect(function(player)
local blockfx = katana.Fx.blocking:Clone()
local goofy = class("Attachment",hrp)
goofy.Name = "att"
blockfx.Parent = goofy
local value = class("BoolValue", character)
value.Value = true
value.Name = "Blocking"
katana.Remotes.BlockingEnded.OnServerEvent:Connect(function(player)
kill(goofy)
kill(value)
--value = false
end)
end)
slashing = true
task.wait(0.1)
slashing = false
end)
gtb (going to bed), see you tmrw