function Damage(humanoid,damage,prot)
if prot then
if prot == 0.1 then
humanoid.Parent.Shield.Health.Value -= damage/1.3
else
humanoid.Health -= (damage*prot)
end
else
humanoid.Health -= damage
end
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
task.wait(3)
local startTime
while task.wait(0.1) do
local humPart = char:FindFirstChild("HumanoidRootPart")
local humanoid = char:FindFirstChild("Humanoid")
if humPart and humanoid then
local part = workspace:FindPartOnRay(Ray.new(humPart.Position,humPart.Position + Vector3.new(0,-4,0)),char)
if not part then
startTime = tick()
else
if startTime then
local currentTime = tick()
if currentTime - startTime >= 0.5 then
startTime = nil
Damage(humanoid,25,char:FindFirstChild("Protection"))
end
end
end
end
end
end)
end)
Nothing much to say here, but the script works fine with damaging me, but it takes about a half second to damage me after I land.