So, basically I’m working on a new tool system on my game BloodLine, and I need some help with something. In Aethelbeorn [ Before the owner get exterminated for stealing a Medkit mesh from someone that I don’t know the name. ], it had a melee system that when you hold MouseButton1, it plays a swing animation and pause it, when you stop holding MouseButton1, it resume the swing animation, if a player hits the tool, it gives damage. I know how to play an animation and give damage if you activate a tool and something hit it ‘ToolMesh’, but I don’t know how to check if a player holds the MouseButton1 until the animation finishs, and if the animation finishs and the player stop holding MouseButton1, it play another swing animation. Here is a example:
[ Click on me to open the video on YouTube. ]
- Thanks for reading, Tsu Washington.
You can basically use
–Server
Tool.Activated–Basically mouseButton1
Tool.Deactivated–Mayhave done spell mistake
those are more server Friendly
you can also use UserInputService
--Local Script
local UIS = game:GetService("UserInputService")--Spelling Mistakes May Exist
UIS.InputBegan:Connect(function(UIT)
if UIT == Enum.UserInputType.MouseButton1
--FireServer somthing like that
end
end)
i Prefer to use serverside
here is a sample
function Slash()
--Play Animation and damage stuff
end)
--Caster
local Cast = false
local On = false
local Off = false
--Activate
Tool.Activated:Connect(function()
if Cast == false then
--Debounce
if On == false then
On = true
Cast = true
repeat
Slash()
print("Slashes")
wait(1)--Delay until it plays again
until Cast == false
wait(0.01)
On = false
--AttackDeb = false
end
end
end)
--
Tool.Deactivated:Connect(function()
if Cast == true then
if Off == false then
Off = true
Cast = false
wait(0.01)
Off = false
end
end
end)
--
As for the different Animation it plays randomly use randomizer code
1 Like
Hum, okay. I’ll try that out and I’ll tell you if it works.