Hello there, my sword for some reason, whenever I equip, or slash it won’t play any sound.
^
This is what my sword looks like.
I don’t know if it is because I made my Handle a MeshPart but if someone could help me I would be much appreciated.
Hello there, my sword for some reason, whenever I equip, or slash it won’t play any sound.
^
This is what my sword looks like.
I don’t know if it is because I made my Handle a MeshPart but if someone could help me I would be much appreciated.
You need to have events and functions that play the sounds in the sword script.
For example,
local Sword = script.Parent
Sword.Equipped:connect(function() -- Fires when equipped
Sword.Handle.EquipSound:Play() -- Plays equip sound
end)
Sword.Activated:connect(function() -- Fires when clicked while equipped
Sword.Handle.SlashSound:Play() --Plays slash sound
end)
Thank you it worked! However my sword is an on-key animation weapon, so whenever you press a key it plays an attack move, how would I implement the sound so when I hit a key it plays both the animation and sound, because so far it only happens when I click.
In a localscript in the sword, you can implement
local Sword = script.Parent
local Equipped = false
Sword.Equipped:connect(function() -- Fires when equipped
Equipped = true
Sword.Handle.EquipSound:Play() -- Plays equip sound
end)
Sword.Unequipped:connect(function()
Equipped = false
end)
game:GetService("UserInputService").InputBegan:connect(function(i, gpe)
if not gpe then -- Checks if not in chat or any CoreGui menus
if i.KeyCode == "KEY_NAME" then
-- Code
end
end
end)