You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am a beginner scriptor and I want to add a sound to a heavily modified Rufus14 weapon. The 2 sounds are meant to go off when a Bullet Hole is created to simulate an impact effect for a rocket launcher. -
What is the issue? Include screenshots / videos if possible!
There isn’t any output (error nor warning) saying that the sound failed in any way, but the sound doesn’t play, they just don’t work when the parent is ‘hole.’ (a part created by ‘Makepart()’ -
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I have checked and all of the sounds were fine and working when I tested them in different areas. Is this a bug or spaghetti coding?
makebhole = function(pos, normal, size, color, parent, material, debristime)
local hole = makepart(
parent,
Vector3.new(0.05, size, size),
CFrame.new(pos),
false,
false,
"buIlethole"
)
hole.CanQuery = false
hole.CanTouch = false
hole.Material = material
hole.BrickColor = color
hole.Shape = Enum.PartType.Cylinder
hole.CFrame = CFrame.lookAt(pos, pos+normal) * CFrame.Angles(math.pi/2,0,math.pi/2)
hole.Transparency = 1
playremovesound("explodenear", hole, 0.5+math.random(-5,5)/70, 0.1)
playremovesound("explodefar", hole, 0.5+math.random(-5,5)/70, 0.1)
local explosion = Instance.new('Explosion')
explosion.BlastPressure = 50000 -- Completely safe explosion
explosion.BlastRadius = 15
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.Position = hole.Position
explosion.Parent = workspace
explosion.Visible = true
explosion.DestroyJointRadiusPercent = 0.333333333
if parent.Anchored then
hole.Anchored = true
else
hole.Anchored = true
end
if debristime then
debris:AddItem(hole, debristime)
end
return hole
end
Sound Effect Data
local sfxdata = { --dont repeat names (id, vol, rollmin, rollmax, playonremove)
["impact1"] = {"341519743", 4, 0.2, 60, true},
["impact2"] = {"1489924400", 4, 0.2, 60, true},
["impact4"] = {"1476374050", 4, 0.2, 60, true},
["impact3"] = {"3802437361", 4, 0.2, 60, true},
["bhf1"] = {"3744371091", 1, 1, 60, true},
["bhf2"] = {"3744371584", 1, 1, 60, true},
["bhf3"] = {"3744371864", 1, 1, 60, true},
["snap"] = {"4086190876", 1, 1, 60, true},
["bone"] = {"4086172420", 1, 1, 60, true},
["pull"] = {"7127178040", 5, 1, 60, true},
["supersonic1"] = {"6113434720", 10, 0.035, 1, true},
["supersonic2"] = {"3809084884", 10, 0.035, 1, true},
["shootnormal"] = {"5700090398", 20, 0.5, 10, true},
["shootaway"] = {"5919825273", 5, 2.5, 1200, true},
["click"] = {"132464034", 4, 1, 60, true},
["equip"] = {"3742321449", 2.5, 1, 60, true},
["reload"] = {"5445945972", 2, 1, 60},
["reload2"] = {"6808988208", 2, 1, 60},
["explodenear"] = {"9114087096", 10, 1, 200, true},
["explodefar"] = {"7423520828", 10, 1, 2000, true}
}
and the main PlayRemoveSound core
playremovesound = function(name, parent, speed, timepos)
local thesound = currentsounds[name]
if not thesound then
print(name, "sound not found")
return
end
thesound.Parent = parent
thesound.PlaybackSpeed = speed
thesound.TimePosition = timepos or 0
thesound.Parent = nil
end
I just need guidance.