Hello. I’m trying to make a sword with the raycast hitbox plugin. but when i use “HitStart” it outputs an error that says Players.marciofrfr.Backpack.LinkedSword.SwordScript:44: attempt to call missing method 'HitStart' of table - Server - SwordScript:44
. Which is confusing, because “HitStart” is clearly a valid method. Sometimes it also says “HitStop” isnt a valid method. Here is the full code of the sword:
local tool = script.Parent
local anim = script.Equip
local hold = script.Hold
local SND = script.Sound
local SlashSND = tool.Handle.Slash
local Trail = tool.Handle.Trail
local Idle = nil
local RS = game:GetService("ReplicatedStorage")
local ComboAnims = RS:WaitForChild("CommonAnims"):FindFirstChild("Combo")
local Slash = ComboAnims.Slash1
local RayHit = require(RS.RaycastHitboxV4)
local Hitbox = RayHit.new(tool.Hit)
tool.Equipped:Connect(function()
local Char = tool.Parent
local Hum = Char:WaitForChild("Humanoid")
local Animator = Hum.Animator
local EquipAnimClip = Animator:LoadAnimation(anim)
EquipAnimClip:Play()
SND:Play()
EquipAnimClip.Stopped:Wait()
local HoldAnimClip = Animator:LoadAnimation(hold)
HoldAnimClip:Play()
Idle = HoldAnimClip
end)
tool.Unequipped:Connect(function()
Idle:Stop()
end)
tool.Activated:Connect(function()
local Char = tool.Parent
local Hum = Char:WaitForChild("Humanoid")
local Animator = Hum.Animator
if Hum:GetAttribute("Attacking") == true then return end
if Hum:GetAttribute("Blocking") == true then return end
Hitbox:HitStart()
Idle:Stop()
Hum:SetAttribute("Attacking", true)
Hum.WalkSpeed = 15
Trail.Enabled = true
SlashSND:Stop()
SlashSND:Play()
local SlashClip = Animator:LoadAnimation(Slash)
SlashClip:Play()
SlashClip.Stopped:Wait()
Hitbox:HitStop()
Trail.Enabled = false
Hum:SetAttribute("Attacking", false)
Idle:Play()
Hum.WalkSpeed = 25
end)
Video Footage:
I tried moving the “HitStart” method to the start, where i define the hitbox, but then the red lines of the raycast, simply dont appear. I dont know if i should post script support for a module, but i really need help!