#GetMarkerReachedSignal happens only once??!
1 messages · Page 1 of 1 (latest)
local tool = script.Parent
local anims = game.ReplicatedStorage:WaitForChild("Anims")
local mp = anims:FindFirstChild("Mini Pekka")
local Slash = mp:FindFirstChild("Slash")
local HitboxModule = require(game.ReplicatedStorage:WaitForChild("Hitbox"))
local newHitbox = HitboxModule.New()
tool.Equipped:Connect(function()
tool:Activate()
end)
tool.Activated:Connect(function()
char = tool.Parent
hrp = char:FindFirstChild("HumanoidRootPart")
hum = char:FindFirstChild("Humanoid")
local attack = hrp:FindFirstChild("Attack")
local pancakes = hrp:FindFirstChild("Pancakes")
local hit = hrp:FindFirstChild("Hit")
local slashtrack = hum:LoadAnimation(Slash)
slashtrack:Play()
attack:Play()
task.wait(.75)
attack:Stop()
slashtrack:GetMarkerReachedSignal("Hit"):Connect(function()
task.spawn(function()
HitboxModule:StartD(char, .3)
end)
char:FindFirstChild("Hitbox").Touched:Connect(function(hit)
local vhum = hit.Parent:FindFirstChild("Humanoid")
local victim = {}
if vhum then
if victim[vhum.Parent] == true then return end
victim[vhum.Parent] = true
print("ya")
end
end)
end)
end)
ping me if u can help
You're connecting events within events
Each time an event occurs, you bind the same callback to the same event, multiplying its reponse
clash royalle?
ya
i still dont get it
local tool = script.Parent
local anims = game.ReplicatedStorage:WaitForChild("Anims")
local mp = anims:FindFirstChild("Mini Pekka")
local Slash = mp:FindFirstChild("Slash")
local HitboxModule = require(game.ReplicatedStorage:WaitForChild("Hitbox"))
local newHitbox = HitboxModule.New()
tool.Equipped:Connect(function()
tool:Activate()
end)
tool.Activated:Connect(function()
char = tool.Parent
hrp = char:FindFirstChild("HumanoidRootPart")
hum = char:FindFirstChild("Humanoid")
local hitboxCFrame = hrp.CFrame * CFrame.new(0,0,-5)
local hitboxSize = Vector3.new(5,5,5)
local createHitbox = workspace:GetPartBoundsInBox(hitboxCFrame, hitboxSize)
local attack = hrp:FindFirstChild("Attack")
local pancakes = hrp:FindFirstChild("Pancakes")
local hit = hrp:FindFirstChild("Hit")
local slashtrack = hum:LoadAnimation(Slash)
slashtrack:Play()
attack:Play()
task.wait(.75)
attack:Stop()
slashtrack:GetMarkerReachedSignal("Hit"):Connect(function()
task.spawn(function()
HitboxModule:StartD(char, .3)
end)
local victim = {}
for _, v in pairs(createHitbox) do
if v.Parent:FindFirstChild("Humanoid") and not victim[v.Parent.Name] and v.Parent ~= char then
vhum = v.Parent:FindFirstChild("Humanoid")
victim[v.Parent.Name] = true
vhum:TakeDamage(10)
hit:Play()
end
end
end)
end)
i fixed it
but now i need help with the animations
the getmarkerreachedsignal("hit") only happens once and when i try to play it again it doesnt work