wklejamy.pl website for sale. You are interested in. Please contact. wklejamy@gmail.com
Click to buy coffe
Untitled
Guest 94 16th Nov, 2023
tool = script.Parent
local speedBoost = 2
local handle = tool:WaitForChild("Handle")
local damage = 25
local lastClick = tick()
local swingtime = 1
local isHit = true
-- Wykonywanie funkcji, gdy miecz jest wyposażony
tool.Equipped:Connect(function()
-- Ustalamy, że humanoid jest naszym graczem
character = tool.Parent
player = game.Players:GetPlayerFromCharacter(character) -- ten wiersz przyda się na następnej lekcji
humanoid = character:FindFirstChild("Humanoid")
if humanoid then
-- Pomnóż aktualną prędkość przez naszą zmienną speedBoost
humanoid.WalkSpeed = humanoid.WalkSpeed * speedBoost
end
end)
tool.Unequipped:Connect(function()
if humanoid then
humanoid.WalkSpeed = humanoid.WalkSpeed / speedBoost
end
end)
--Aktywuj funkcję naciskając lewy przycisk myszy na ekranie
tool.Activated:Connect(function()
--Utwórz zmienną, która będzie rejestrować czas pomiędzy bieżącym zamachem a ostatnim zamachem
local clickDelta = tick() - lastClick
--Jeśli czas między bieżącym zamachem a ostatnim zamachem jest dłuższy niż czas zamachu (w naszym przypadku 1 sekunda), to
if clickDelta > swingtime then
--Aktualizacja czasu ostatniego ataku
lastClick= tick()
--Ustaw zmienną obrażeń na false (powrócimy do tej części w następnym zadaniu)
isHit = false
end
end)
handle.Touched:Connect(function(hit)
if hit and humanoid.Health > 0 then
local targetHumanoid = hit.Parent:FindFirstChild("Humanoid")
if targetHumanoid and targetHumanoid.Health > 0 and not isHit then
isHit = true
targetHumanoid:TakeDamage(damage)
end
end
end)
To share this paste please copy this url and send to your friends
RAW Paste Data