So I am trying to get some sound effects to work, but I am having a hard time getting it to use the variable instaid of the string.
local Fists = Instance.new("Sound", KillBox)
Fists.SoundId = "rbxassetid://8646342913"
Fists.EmitterSize = 10
Fists.Parent = KillBox
local Knife = Instance.new("Sound", KillBox)
Knife.SoundId = "rbxassetid://220833976"
Knife.EmitterSize = 10
Knife.Parent = KillBox
local attack = script:GetAttribute("Weapon")
local attackID = script:GetAttribute("SoundID")
attack:Play(attackID)
The “attackID” works fine because it’s just a number, but “attack” needs to be a variable, and it is currently just a string. I have been tinkering around and searching for answers online, but I cant find something that works for this.
What is an example of the string that is stored in the Weapon attribute?
What is the position of the sounds in explorer? (Send a screenshot of the explorer where the sound files are visible, with their path also being visible)
The sounds are inside a “Killbox”, which is inside a player model. Is the problem that all the sounds have the same name? I never had that problem before.