Can someone help me see what I did wrong.
module:
--!nocheck
local DB = false
local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local AnimationFolder = game.ReplicatedStorage.Assets.Animations.EarthStrike
local RemoteFolder = game.ReplicatedStorage:WaitForChild("Assets").RemoteEvents
local Remote = RemoteFolder.RemoteEvent
local HitBoxModule = require(game.ReplicatedStorage.Assets.Modules.Hitbox)
local MakeHitbox = HitBoxModule:CreateHitbox(Char:WaitForChild("Right Leg").Position,game.Workspace)
local module = {}
local MoveStats = {
Damage = 1.5,
Cooldown = 1
}
function module.Stats(self)
local MT = setmetatable(self or {},MoveStats)
self.Damage = 1.5 or self.Damage
self.Cooldown = 2 or self.Cooldown
module.__index = self
return MT
end
local Fs = function(inp,gpe)
if gpe then return end
local Hum = Char:FindFirstChildOfClass("Humanoid")
local Animator = Hum:FindFirstChildOfClass("Animator")
local Track = Animator:LoadAnimation(AnimationFolder.Stomp)
local ESstats = module.Stats({})
if inp.KeyCode == Enum.KeyCode.One and DB == false and Char:GetAttribute("Class") == "EarthStrike" then
DB = true
Remote:FireServer()
Remote.OnClientEvent:Connect(function()
Track:Play()
Track:GetMarkerReachedSignal("Activate"):Once(function()
MakeHitbox:Once()
end)
end)
DB = false
end
end
function module:Test()
local UIS = game:GetService("UserInputService")
UIS.InputEnded:Connect(Fs)
end
return module
Hitbox Module:
local module = {}
function module:CreateHitbox(Position:Vector3,Parent:Instance)
local Hitbox = Instance.new("Part")
Hitbox.Name = "Hitbox"
Hitbox.Transparency = 0.75
Hitbox.CanCollide = false
Hitbox.CanTouch = true
Hitbox.Anchored = true
Hitbox.Position = Position
Hitbox.Parent = Parent
task.wait(1)
Hitbox:Destroy()
end
return module
https://gyazo.com/cab51f2e6a643fee2a98fa2516146c46
In the end I just want one hitbox part spawning each time not several