Im making an effect that if the players velocity is over a certain value and then it hits an object then a brick from replicatedstorage gets cloned 5 times to player, to create the effect of the object "breaking". No errors But what happens is that when the player jumps off the ground, the effect get cloned, which is not what's supposed to happen.
local Humanoid = script.Parent.Humanoid
local busy = false
function collided_With_Something(hit)
if not busy and hit.Parent.Name ~= "broke" then
busy = true
if script.Parent.HumanoidRootPart.Velocity.Magnitude > 150 then
for i = 1,5 do
print(i)
local bro = game.ReplicatedStorage.broke:Clone()
bro.Parent = workspace
bro.CFrame = script.Parent.HumanoidRootPart.CFrame
bro.Color = hit.Color
end
end
wait(3)
busy = false
end
end
Humanoid.Touched:Connect(collided_With_Something)

2 comments
This will run for every part of the humanoid. You need to define what parts should cause the effect, it might be better to use the touched event of the part rather than the humanoid.
its meant to be the whole player