So, I took a break from roblox studio and… I forgot how to script.
I’m currently making a game that needs a knife system but I need help with it. Yes, I’ve looked on youtube but I’ve found nothing, just outdated videos. Devforum is literally my only choice to ask for help.
Also, for the damage part I recommend using a detector part instead of blade.Touched. Basically just weld an invisible, canCollide = false part to the player’s hand or HumanoidRootPart, and check if there are any NPCs inside the area with GetTouchingParts when you click
Alright, I tried both scripts but it doesn’t work. I looked in the output and there wasn’t any errors. I tried the print function too but it didn’t print aswell and idk what to do
Sorry for the late reply, but literally nothing works. There’s just a tool in my inventory and that’s it. No animations are playing, m1’s don’t work.
The knife is just a handle part and a mesh part which is the actual knife. There’s a weld constraint inside the handle which just welds both of the parts together.
I can’t show the scripts right now, but I copied the scripts in the links and just edited it so the paths to the animations and such are correct.
local player = script.Parent.Parent.Parent
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local equipAnim = humanoid:LoadAnimation() -- load an animation you want to use
local unequipAnim = humanoid:LoadAnimation()
local hitAnim = humanoid:LoadAnimation()
script.Parent.Equipped:Connect(function(a)
equipAnim:Play()
end)
script.Parent.Unequipped:Connect(function(a)
unequipAnim:Play()
end)
script.Parent.Activated:Connect(function(a)
hitAnim:Play()
end)
I just tried this script and it works for me. It is just a normal script in the tool, next to the Handle and that’s it.
It doesn’t matter if it’s massless or not (but massless is better), it should work. If that script doesn’t work, something else is the problem. Are there still no errors in the output?