How to make a simple animated melee weapon with sound. FAST!! Roblox Studio

preview_player
Показать описание
Sorry there is no voice my video editor broke part way through making this video.

Here is the Code:
local db = false
local hit = false
script.Parent.Activated:Connect(function()
if script.Parent.Parent:IsA("Model") and not db then
db = true
script.Parent.Handle.Swing:Play()
script.Parent.Parent:FindFirstChildOfClass("Humanoid"):LoadAnimation(script.Parent.Animation):Play()
wait(0.7)
db = false
hit = false
end
end)

script.Parent.Part.Touched:Connect(function(otherPart: BasePart)
print("yes")
if otherPart.Parent:IsA("Model") and db and not hit then
otherPart.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(30)

hit = true
script.Parent.Handle.Hit:Play()
elseif otherPart.Parent:IsA("Accessory") and db and not hit then
otherPart.Parent.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(30)
hit = true
script.Parent.Handle.Hit:Play()
end

end)
Рекомендации по теме
Комментарии
Автор

The code goes in a normal script here it is: local db = false
local hit = false

if and not db then
db = true


wait(0.7)
db = false
hit = false
end
end)

BasePart)
= Random.new():NextNumber(0.9, 1.25)
print("yes")
if otherPart.Parent:IsA("Model") and db and not hit then


hit = true

elseif and db and not hit then

hit = true

end

end)

Bob
Автор

More vids on the template. Maybe how to make a knife in the system like csgo

Preamac