How to make a Basic Sword | ROBLOX Studio
Vložit
- čas přidán 29. 06. 2024
- This is a very simplistic tutorial on how to make a basic sword in roblox studio. I will probably made a advanced sword later on.
If this video gets like 50 likes i'll make a part 2 with sword combos 👀
Join the discord server for stuff
Thanks for watching
I cant really put the code becuase CZcams isnt letting me but i'll put the local one here and he server in comments.
Local:
local Sword = script.Parent
local AttackAnimation = game.ReplicatedStorage.Animations.Attack
local hitboxEvent = game.ReplicatedStorage.Remotes.Hitbox
--Values
local cooldown = false
local cooldownTime = 1
Sword.Activated:Connect(function()
--make animation play
if cooldown == false then
local humanoid = Sword.Parent:FindFirstChild("Humanoid")
local Animator = humanoid:FindFirstChild("Animator")
if humanoid and Animator then
local AnimationTrack = Animator:LoadAnimation(AttackAnimation)
AnimationTrack:Play()
--Damage
hitboxEvent:FireServer()
cooldown = true
wait(cooldownTime)
cooldown = false
end
end
end)
Socials:
Discord: aspectratio
Discord Server: / discord
CZcams Channel: / @aspectratio_yt
Twitter: / madpuncher100x
Server Side:
local hitboxEvent = game.ReplicatedStorage.Remotes.Hitbox
local hitboxDestroyTime = 0.2
local Ifhit = false
hitboxEvent.OnServerEvent:Connect(function(player)
local hitbox = Instance.new("Part")
hitbox.Size = Vector3.new(8,8,8)
hitbox.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-3)
hitbox.Transparency = 1
hitbox.CanCollide = false
hitbox.Anchored = true
hitbox.Parent = workspace
--Damaged touched
hitbox.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and humanoid.Health > 0 and hit.Parent.Name ~= player.Name and Ifhit == false then
Ifhit = true
humanoid:TakeDamage(10)
wait(hitboxDestroyTime + 0.1)
Ifhit = false
end
end)
game.Debris:AddItem(hitbox, hitboxDestroyTime)
end)
Thanks for watching
In Sha Allah u will get famous
i love ur vids
samesame
thanks