Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Roblox Studio Tutorial How to make a simple ability with hitbox and knockback.

Автор: RedwithWhite

Загружено: 2025-06-17

Просмотров: 1902

Описание:

A simple Roblox script that makes a hitbox when you press E and when it hits you take damage and knockback.

If you don't know what animation events are, watch another video on YouTube, then come back once you understand it.



Local Script:

local plr = game.Players.LocalPlayer
local chr = plr.Character
local hum = chr:FindFirstChildWhichIsA("Humanoid")
local Animator = hum:FindFirstChildWhichIsA("Animator")

local Animation = Animator:LoadAnimation(script.Animations.Animation)

local RootPart = chr:FindFirstChild("HumanoidRootPart")


local hitbox


local UIS = game:GetService("UserInputService")


local CanDoMove = true


----------------HitBox Stuff---------------------------
local hitboxsize = Vector3.new(4,3,3)
local hit_db = false
local hitlist = {}--for attacks to hit multiple players at the same time





----------------------------------------------------------





UIS.InputBegan:Connect(function(input, GPE)

if GPE == false then

if CanDoMove == true and input.KeyCode == Enum.KeyCode.E then

Animation:Play(0,1,1)

end



end

end)


Animation:GetMarkerReachedSignal("Start"):Connect(function()-----When the animation starts
CanDoMove = false
hit_db = false


end)



Animation:GetMarkerReachedSignal("HitBox_On"):Connect(function()-----When the hitbox starts

if hitbox == nil then
hitbox = Instance.new("Part",workspace)
hitbox.Position = RootPart.Position + RootPart.CFrame.LookVector * 5--Position the hitbox
hitbox.Rotation = RootPart.Rotation
hitbox.Shape = Enum.PartType.Block
hitbox.Transparency = 1
hitbox.Color = Color3.fromRGB(255, 0, 0)
hitbox.Size = hitboxsize
hitbox.Material = Enum.Material.Neon
hitbox.CanCollide = false
hitbox.CanTouch = true
hitbox.CanQuery = false
hitbox.CastShadow = false
hitbox.Anchored = false
hitbox.Massless = true

local w = Instance.new("WeldConstraint", hitbox)--weld hitbox to character
w.Part0 = hitbox
w.Part1 = RootPart

hitbox.Touched:Connect(function(Hit)--when the hitbox hits something
--this one will be one tap method
if hit_db == false then
hit_db = true

if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent:FindFirstChildWhichIsA("Humanoid") ~= nil and Hit.Parent ~= chr then--checks to make sure its a character that isnt you
print("THIS IS A CHARACTER")

script.RemoteEvents.Hit:FireServer(Hit.Parent)--send the instance of our enemy to the server so we can apply the damage on the server


end



end


end)


else



hitbox:Destroy()
task.wait(0.01)
hitbox = Instance.new("Part",workspace)
hitbox.Position = RootPart.Position + RootPart.CFrame.LookVector * 5--Position the hitbox
hitbox.Rotation = RootPart.Rotation
hitbox.Shape = Enum.PartType.Block
hitbox.Transparency = 1
hitbox.Color = Color3.fromRGB(255,0,0)
hitbox.Size = hitboxsize
hitbox.Material = Enum.Material.Neon
hitbox.CanCollide = false
hitbox.CanTouch = true
hitbox.CanQuery = false
hitbox.CastShadow = false
hitbox.Anchored = false
hitbox.Massless = true

local w = Instance.new("WeldConstraint", hitbox)--weld hitbox to character
w.Part0 = hitbox
w.Part1 = RootPart

hitbox.Touched:Connect(function(Hit)--when the hitbox hits something
--this one will be one tap method
if hit_db == false then
hit_db = true

if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent:FindFirstChildWhichIsA("Humanoid") ~= nil and Hit.Parent ~= chr then--checks to make sure its a character that isnt you
print("THIS IS A CHARACTER")

script.RemoteEvents.Hit:FireServer(Hit.Parent)--send the instance of our enemy to the server so we can apply the damage on the server

end



end


end)

end




end)


Animation:GetMarkerReachedSignal("HitBox_Off"):Connect(function()-----When the hitbox stops
if hitbox ~= nil then--destroy the hitbox
hitbox:Destroy()
end
end)


Animation:GetMarkerReachedSignal("End"):Connect(function()-----When the move stops
CanDoMove = true
end)



Server script will be in comments. Didn't fit in here :(

Roblox Studio Tutorial How to make a simple ability with hitbox and knockback.

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Самый сложный бейдж в Роблоксе

Самый сложный бейдж в Роблоксе

Как россиян отключают от интернета

Как россиян отключают от интернета

Как бы выглядел человек в 4D?

Как бы выглядел человек в 4D?

Я СОЗДАЛ МЫШКУ, КОТОРАЯ ВЕСИТ 29 ГРАММ! — NIMBUS

Я СОЗДАЛ МЫШКУ, КОТОРАЯ ВЕСИТ 29 ГРАММ! — NIMBUS

Блесткобомба 3.0 vs Грабители Посылок

Блесткобомба 3.0 vs Грабители Посылок

Материалы Unreal Engine 6 уровней сложности

Материалы Unreal Engine 6 уровней сложности

Я проверил самый ДЕШЁВЫЙ круиз в России... (3 дня ада)

Я проверил самый ДЕШЁВЫЙ круиз в России... (3 дня ада)

Я Проверил НОВОЕ Копьё в Майнкрафте

Я Проверил НОВОЕ Копьё в Майнкрафте

Bounding Hitboxes | How It Works | Roblox Studio

Bounding Hitboxes | How It Works | Roblox Studio

Блокировка Roblox..

Блокировка Roblox..

БЕЛЫЕ СПИСКИ: какой VPN-протокол справится? Сравниваю все

БЕЛЫЕ СПИСКИ: какой VPN-протокол справится? Сравниваю все

ЧТО ЕСЛИ 30 Спецназовцев против 300 Спартанцев? Битва при Фермопилах!

ЧТО ЕСЛИ 30 Спецназовцев против 300 Спартанцев? Битва при Фермопилах!

3 часа против 3 лет Blender

3 часа против 3 лет Blender

Принц Персии: разбираем код гениальной игры, вытирая слезы счастья

Принц Персии: разбираем код гениальной игры, вытирая слезы счастья

Робот-Пианино Загорелся, Играя Rush E (Сложнейшую Песню в Мире)

Робот-Пианино Загорелся, Играя Rush E (Сложнейшую Песню в Мире)

LLM и GPT - как работают большие языковые модели? Визуальное введение в трансформеры

LLM и GPT - как работают большие языковые модели? Визуальное введение в трансформеры

100 Ютуберов Симулируют Голодные Игры

100 Ютуберов Симулируют Голодные Игры

Сделал визуализацию 4D, 5D, 6D. Как выглядит 6D мир?

Сделал визуализацию 4D, 5D, 6D. Как выглядит 6D мир?

Создание игры Battlegrounds | Roblox Devlog

Создание игры Battlegrounds | Roblox Devlog

Отважный Хакер - Спас интернет, но поплатился жизнью

Отважный Хакер - Спас интернет, но поплатился жизнью

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]