Hello!
I started remaking RCL Gun system from 2016. I created a place for others to test out remaked gun system, but sounds do not work for others e.g. When I’m reload, nobody can hear this sounds and vice versa. Also here’s testing place Game
Also you can join to me right now
Is the script playing the sounds a localscript?
Negative, It’s in casual script
Make sure the sound effects are on the server, having them in a local folder like playergui won’t play the sound for other players.
If you are using tools you can place the sound effect inside of the tool.
I placed them into tools. Also I don’t know why sounds do not play even in my old game that using that gun system
Here’s script from that gun system
local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")
local Player
local Character
local Humanoid
local FastCast = require(Tool:WaitForChild("FastCast"))
local Module = require(Tool:WaitForChild("Setting"))
local ChangeMagAndAmmo = script:WaitForChild("ChangeMagAndAmmo")
local MouseEvent = script:WaitForChild("MouseEvent")
local MuzzleEvent = script:WaitForChild("MuzzleEvent")
local MarkerEvent = script:WaitForChild("MarkerEvent")
local Grip2
local Handle2
if Module.DualEnabled then
Handle2 = Tool:WaitForChild("Handle2",1)
if Handle2 == nil and Module.DualEnabled then error("\"Dual\" setting is enabled but \"Handle2\" is missing!") end
end
local MagValue = script:FindFirstChild("Mag") or Instance.new("NumberValue",script)
MagValue.Name = "Mag"
MagValue.Value = Module.AmmoPerMag
local AmmoValue = script:FindFirstChild("Ammo") or Instance.new("NumberValue",script)
AmmoValue.Name = "Ammo"
AmmoValue.Value = Module.LimitedAmmoEnabled and Module.Ammo or 0
if Module.IdleAnimationID ~= nil or Module.DualEnabled then
local IdleAnim = Instance.new("Animation",Tool)
IdleAnim.Name = "IdleAnim"
IdleAnim.AnimationId = "rbxassetid://"..(Module.DualEnabled and 53610688 or Module.IdleAnimationID)
end
if Module.FireAnimationID ~= nil then
local FireAnim = Instance.new("Animation",Tool)
FireAnim.Name = "FireAnim"
FireAnim.AnimationId = "rbxassetid://"..Module.FireAnimationID
end
if Module.ReloadAnimationID ~= nil then
local ReloadAnim = Instance.new("Animation",Tool)
ReloadAnim.Name = "ReloadAnim"
ReloadAnim.AnimationId = "rbxassetid://"..Module.ReloadAnimationID
end
if Module.ShotgunClipinAnimationID ~= nil then
local ShotgunClipinAnim = Instance.new("Animation",Tool)
ShotgunClipinAnim.Name = "ShotgunClipinAnim"
ShotgunClipinAnim.AnimationId = "rbxassetid://"..Module.ShotgunClipinAnimationID
end
if Module.HoldDownAnimationID ~= nil then
local HoldDownAnim = Instance.new("Animation",Tool)
HoldDownAnim.Name = "HoldDownAnim"
HoldDownAnim.AnimationId = "rbxassetid://"..Module.HoldDownAnimationID
end
if Module.EquippedAnimationID ~= nil then
local EquippedAnim = Instance.new("Animation",Tool)
EquippedAnim.Name = "EquippedAnim"
EquippedAnim.AnimationId = "rbxassetid://"..Module.EquippedAnimationID
end
ChangeMagAndAmmo.OnServerEvent:connect(function(Player,Mag,Ammo)
MagValue.Value = Mag
AmmoValue.Value = Ammo
end)
--Now we set the caster values
local Caster = FastCast.new()
Caster.Gravity = Module.DropGravity
Caster.ExtraForce = Module.WindOffset
--Make a base cosmetic bullet object. This will be cloned every time we fire off a ray
local CosmeticBullet = Instance.new("Part")
CosmeticBullet.Material = Enum.Material.Plastic
CosmeticBullet.Color = Color3.fromRGB(111, 55, 0)
CosmeticBullet.CanCollide = false
CosmeticBullet.Anchored = true
CosmeticBullet.Size = Vector3.new(0.3, 0.3, 2.7)
CosmeticBullet.Transparency = 1
--Extra stuff
local Bow = Instance.new("SpecialMesh", CosmeticBullet)
Bow.MeshType = "FileMesh"
Bow.MeshId = "http://www.roblox.com/asset/?id=0"
Bow.TextureId = "http://www.roblox.com/asset/?id=0"
Bow.Scale = Vector3.new(1, 1.25, 2)
function numLerp(A, B, Alpha)
return A + (B - A) * Alpha
end
function MakeImpactFX(Hit, Position, Normal)
local surfaceCF = CFrame.new(Position, Position + Normal)
if Module.HitEffectEnabled then
local Attachment = Instance.new("Attachment")
Attachment.CFrame = surfaceCF
Attachment.Parent = workspace.Terrain
local Sound = Instance.new("Sound",Attachment)
Sound.SoundId = "rbxassetid://"..Module.HitSoundIDs[math.random(1,#Module.HitSoundIDs)]
Sound.PlaybackSpeed = Module.HitSoundPitch
Sound.Volume = Module.HitSoundVolume
local function spawner2(material)
local C = script:WaitForChild("HitEffect")[material.Name]:GetChildren()
for i=1,#C do
if C[i].className == "ParticleEmitter" then
local count = 1
local Particle = C[i]:Clone()
Particle.Parent = Attachment
if Particle:FindFirstChild("EmitCount") then
count = Particle.EmitCount.Value
end
if Particle.PartColor.Value then
Particle.Color = ColorSequence.new(Hit.Color,Hit.Color)
end
delay(0.01,function()
Particle:Emit(count)
game.Debris:AddItem(Particle,Particle.Lifetime.Max)
end)
end
end
Sound:Play()
end
if not Module.CustomHitEffect then
if Hit.Material==Enum.Material.Plastic then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Slate then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Concrete then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.CorrodedMetal then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.DiamondPlate then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Foil then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Marble then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Granite then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Brick then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Pebble then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.SmoothPlastic then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Metal then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Cobblestone then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Neon then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Wood then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.WoodPlanks then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Glass then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Grass then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Sand then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Fabric then spawner2(Hit.Material) end
if Hit.Material==Enum.Material.Ice then spawner2(Hit.Material) end
else
spawner2(script:WaitForChild("HitEffect").Custom)
end
game.Debris:AddItem(Attachment,10)
end
if Module.BulletHoleEnabled then
local Hole = Instance.new("Part")
Hole.Name = "Bullet"
Hole.Transparency = 1
Hole.Anchored = true
Hole.CanCollide = false
Hole.FormFactor = "Custom"
Hole.Size = Vector3.new(1, 1, 0.2)
Hole.TopSurface = 0
Hole.BottomSurface = 0
local Mesh = Instance.new("BlockMesh")
Mesh.Offset = Vector3.new(0, 0, 0)
Mesh.Scale = Vector3.new(Module.BulletHoleSize, Module.BulletHoleSize, 0)
Mesh.Parent = Hole
local Decal = Instance.new("Decal")
Decal.Face = Enum.NormalId.Front
Decal.Texture = "rbxassetid://"..Module.BulletHoleTexture[math.random(1,#Module.BulletHoleTexture)]
if Module.PartColor then
Decal.Color3 = Hit.Color
end
Decal.Parent = Hole
Hole.Parent = workspace.Ignore
Hole.CFrame = surfaceCF * CFrame.Angles(0, 0, math.random(0, 360))
if (not Hit.Anchored) then
local Weld = Instance.new("Weld", Hole)
Weld.Part0 = Hit
Weld.Part1 = Hole
Weld.C0 = Hit.CFrame:toObjectSpace(surfaceCF * CFrame.Angles(0, 0, math.random(0, 360)))
Hole.Anchored = false
end
delay(Module.BulletHoleVisibleTime, function()
if Module.BulletHoleVisibleTime > 0 then
local t0 = tick()
while true do
local Alpha = math.min((tick() - t0) / Module.BulletHoleFadeTime, 1)
Decal.Transparency = numLerp(0, 1, Alpha)
if Alpha == 1 then break end
game:GetService("RunService").Heartbeat:wait()
end
Hole:Destroy()
else
Hole:Destroy()
end
end)
end
end
function MakeBloodFX(Hit, Position, Normal)
local surfaceCF = CFrame.new(Position, Position + Normal)
if Module.BloodEnabled then
local Attachment = Instance.new("Attachment")
Attachment.CFrame = surfaceCF
Attachment.Parent = workspace.Terrain
local Sound = Instance.new("Sound",Attachment)
Sound.SoundId = "rbxassetid://"..Module.HitCharSndIDs[math.random(1,#Module.HitCharSndIDs)]
Sound.PlaybackSpeed = Module.HitCharSndPitch
Sound.Volume = Module.HitCharSndVolume
local function spawner3()
local C = script:WaitForChild("BloodEffect"):GetChildren()
for i=1,#C do
if C[i].className == "ParticleEmitter" then
local count = 1
local Particle = C[i]:Clone()
Particle.Parent = Attachment
if Particle:FindFirstChild("EmitCount") then
count = Particle.EmitCount.Value
end
delay(0.01,function()
Particle:Emit(count)
game.Debris:AddItem(Particle,Particle.Lifetime.Max)
end)
end
end
Sound:Play()
end
spawn(spawner3)
game.Debris:AddItem(Attachment,10)
end
if Module.FleshHole then
local Hole = Instance.new("Part")
Hole.Name = "Bullet"
Hole.Transparency = 1
Hole.Anchored = true
Hole.CanCollide = false
Hole.FormFactor = "Custom"
Hole.Size = Vector3.new(1, 1, 0.2)
Hole.TopSurface = 0
Hole.BottomSurface = 0
local Mesh = Instance.new("BlockMesh")
Mesh.Offset = Vector3.new(0, 0, 0)
Mesh.Scale = Vector3.new(Module.FleshHoleSize, Module.FleshHoleSize, 0)
Mesh.Parent = Hole
local Decal = Instance.new("Decal")
Decal.Face = Enum.NormalId.Front
Decal.Texture = "rbxassetid://"..Module.FleshHoleTexture[math.random(1,#Module.FleshHoleTexture)]
Decal.Color3 = Module.FleshHoleColor
Decal.Parent = Hole
Hole.Parent = workspace.Ignore
Hole.CFrame = surfaceCF * CFrame.Angles(0, 0, math.random(0, 360))
if (not Hit.Anchored) then
local Weld = Instance.new("Weld", Hole)
Weld.Part0 = Hit
Weld.Part1 = Hole
Weld.C0 = Hit.CFrame:toObjectSpace(surfaceCF * CFrame.Angles(0, 0, math.random(0, 360)))
Hole.Anchored = false
end
delay(Module.FleshHoleVisibleTime, function()
if Module.FleshHoleVisibleTime > 0 then
local t0 = tick()
while true do
local Alpha = math.min((tick() - t0) / Module.FleshHoleFadeTime, 1)
Decal.Transparency = numLerp(0, 1, Alpha)
if Alpha == 1 then break end
game:GetService("RunService").Heartbeat:wait()
end
Hole:Destroy()
else
Hole:Destroy()
end
end)
end
end
function Fire(Direction, FirePointObject)
--Called when we want to fire the gun
if Tool.Parent:IsA("Backpack") then return end --Can't fire if it's not equipped
--Prepare a new cosmetic bullet
local Bullet = CosmeticBullet:Clone()
Bullet.CFrame = CFrame.new(FirePointObject.WorldPosition, FirePointObject.WorldPosition + Direction)
Bullet.Parent = workspace.Ignore
if Module.WhizSoundEnabled then
local Sound = Instance.new("Sound",Bullet)
Sound.SoundId = "rbxassetid://"..Module.WhizSoundID[math.random(1,#Module.WhizSoundID)]
Sound.PlaybackSpeed = Module.WhizSoundPitch
Sound.Volume = Module.WhizSoundVolume
Sound.Looped = true
Sound:Play()
end
if Module.BulletTracerEnabled then
local A0 = Instance.new("Attachment", Bullet)
A0.Position = Vector3.new(Module.BulletTracerOffset0.X, Module.BulletTracerOffset0.Y, Module.BulletTracerOffset0.Z)
A0.Name = "Attachment0"
local A1 = Instance.new("Attachment", Bullet)
A1.Position = Vector3.new(Module.BulletTracerOffset1.X, Module.BulletTracerOffset1.Y, Module.BulletTracerOffset1.Z)
A1.Name = "Attachment1"
local C = script:WaitForChild("TracerEffect"):GetChildren()
for i=1,#C do
if C[i].className == "Trail" then
local count = 1
local Tracer = C[i]:Clone()
Tracer.Parent = Bullet
Tracer.Attachment0 = A0
Tracer.Attachment1 = A1
end
end
end
if Module.BulletParticleEnaled then
local C = script.ParticleEffect:GetChildren()
for i=1,#C do
if C[i].className == "ParticleEmitter" then
local Particle = C[i]:Clone()
Particle.Parent = Bullet
Particle.Enabled = true
end
end
end
Caster:FireWithBlacklist(FirePointObject.WorldPosition, Direction * Module.Range, Module.BulletSpeed, {Handle, Tool.Parent, game.Workspace:FindFirstChild("Ignore")}, Bullet)
end
function DoDamage(Player, TargetHumanoid, TargetTorso, Damage, Knockback, Lifesteal, FlamingBullet)
if Player and TargetHumanoid and TargetHumanoid.Health ~= 0 and TargetTorso then
while TargetHumanoid:FindFirstChild("creator") do
TargetHumanoid.creator:Destroy()
end
local creator = Instance.new("ObjectValue",TargetHumanoid)
creator.Name = "creator"
creator.Value = Player
game.Debris:AddItem(creator,5)
TargetHumanoid:TakeDamage(Damage)
if Knockback > 0 then
local shover = Tool.Parent.HumanoidRootPart or Tool.Parent.Head
local duration = 0.1
local speed = Knockback/duration
local velocity = (TargetTorso.Position - shover.Position).unit * speed
local shoveForce = Instance.new("BodyVelocity")
shoveForce.maxForce = Vector3.new(1e9, 1e9, 1e9)
shoveForce.velocity = velocity
shoveForce.Parent = TargetTorso
game:GetService("Debris"):AddItem(shoveForce, duration)
end
if Lifesteal > 0 and Humanoid and Humanoid.Health ~= 0 then
Humanoid.Health = Humanoid.Health + (Damage*Lifesteal)
end
if FlamingBullet then
local Debuff = TargetHumanoid.Parent:FindFirstChild("IgniteScript") or script.IgniteScript:Clone()
Debuff.creator.Value = Player
Debuff.Disabled = false
Debuff.Parent = TargetHumanoid.Parent
end
end
end
function OnRayHit(HitPart, HitPoint, Normal, Material, CosmeticBulletObject)
--This function will be connected to the Caster's "RayHit" event
--CosmeticBulletObject.Transparency = 1 --In case
CosmeticBulletObject.CFrame = CosmeticBulletObject.CFrame --This will make cosmetic bullet stop traveling
game.Debris:addItem(CosmeticBulletObject, 5) --Destroy cosmetic bullet
local C = CosmeticBulletObject:GetChildren()
for i=1,#C do
if C[i].className == "ParticleEmitter" then
C[i].Enabled = false --Disable particle
end
end
if not Module.ExplosiveEnabled then
if HitPart and HitPart.Parent then --Test if we hit something
local TargetHumanoid = HitPart.Parent:FindFirstChild("Human")or HitPart.Parent:FindFirstChild("Humanoid")
local TargetTorso = HitPart.Parent:FindFirstChild("HumanoidRootPart") or HitPart.Parent:FindFirstChild("Head")
--local TargetTEAM = HitPart.Parent:FindFirstChild("TEAM") --Custom anti-teamkill
--local TargetTeam = game.Players:GetPlayerFromCharacter(TargetHumanoid.Parent) --Normal anti-teamkill
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
--if TargetTEAM and TargetTEAM.Value ~= TEAM.Value then --Custom anti-teamkill
--if TargetTeam and TargetTeam ~= nil then --Normal anti-teamkill
--if Player and Player~= nil and Player.TeamColor ~= TargetTeam.TeamColor then --Custom anti-teamkill
MakeBloodFX(HitPart, HitPoint, Normal)
DoDamage(Player,
TargetHumanoid,
TargetTorso,
(HitPart.Name == "Head" and Module.HeadshotEnabled) and Module.BaseDamage * Module.HeadshotDamageMultiplier or Module.BaseDamage,
Module.Knockback,
Module.Lifesteal,
Module.FlamingBullet)
MarkerEvent:FireClient(Player, (HitPart.Name == "Head" and Module.HeadshotEnabled))
--end
--end
--end
else
MakeImpactFX(HitPart, HitPoint, Normal)
end
end
else
if Module.ExplosionSoundEnabled then
local Sound = Instance.new("Sound",CosmeticBulletObject)
Sound.SoundId = "rbxassetid://"..Module.ExplosionSoundIDs[math.random(1,#Module.ExplosionSoundIDs)]
Sound.PlaybackSpeed = Module.ExplosionSoundPitch
Sound.Volume = Module.ExplosionSoundVolume
Sound:Play()
end
local Explosion = Instance.new("Explosion")
Explosion.BlastRadius = 5
Explosion.BlastPressure = 0
Explosion.Position = HitPoint
Explosion.Parent = workspace
if Module.CustomExplosion then
Explosion.Visible = false
local surfaceCF = CFrame.new(HitPoint, HitPoint + Normal)
local Attachment = Instance.new("Attachment")
Attachment.CFrame = surfaceCF
Attachment.Parent = workspace.Terrain
local function spawner4()
local C = script:WaitForChild("ExplosionEffect"):GetChildren()
for i=1,#C do
if C[i].className == "ParticleEmitter" then
local count = 1
local Particle = C[i]:Clone()
Particle.Parent = Attachment
if Particle:FindFirstChild("EmitCount") then
count = Particle.EmitCount.Value
end
delay(0.01,function()
Particle:Emit(count)
game.Debris:AddItem(Particle,Particle.Lifetime.Max)
end)
end
end
end
spawn(spawner4)
game.Debris:AddItem(Attachment,10)
end
Explosion.Hit:connect(function(HitPart)
if HitPart and HitPart.Parent and HitPart.Name == "HumanoidRootPart" or HitPart.Name == "Head" then
local TargetHumanoid = HitPart.Parent:FindFirstChild("Humanoid")
local TargetTorso = HitPart.Parent:FindFirstChild("HumanoidRootPart") or HitPart.Parent:FindFirstChild("Head")
--local TargetTEAM = HitPart.Parent:FindFirstChild("TEAM") --Custom anti-teamkill
--local TargetTeam = game.Players:GetPlayerFromCharacter(TargetHumanoid.Parent) --Normal anti-teamkill
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
--if TargetTEAM and TargetTEAM.Value ~= TEAM.Value then --Custom anti-teamkill
--if TargetTeam and TargetTeam ~= nil then --Normal anti-teamkill
--if Player and Player~= nil and Player.TeamColor ~= TargetTeam.TeamColor then --Normal anti-teamkill
DoDamage(Player,
TargetHumanoid,
TargetTorso,
(HitPart.Name == "Head" and Module.HeadshotEnabled) and Module.BaseDamage * Module.HeadshotDamageMultiplier or Module.BaseDamage,
Module.Knockback,
Module.Lifesteal,
Module.FlamingBullet)
MarkerEvent:FireClient(Player, (HitPart.Name == "Head" and Module.HeadshotEnabled))
--end
--end
--end
end
end
end)
end
end
function OnRayUpdated(CastOrigin, SegmentOrigin, SegmentDirection, Length, CosmeticBulletObject)
--Whenever the caster steps forward by one unit, this function is called
--The bullet argument is the same object passed into the fire function
local BulletLength = CosmeticBulletObject.Size.Z / 2 --This is used to move the bullet to the right spot based on a CFrame offset
CosmeticBulletObject.CFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentDirection) * CFrame.new(0, 0, -(Length - BulletLength))
end
Tool.Equipped:connect(function()
Player = game.Players:GetPlayerFromCharacter(Tool.Parent)
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Caster.IgnoreDescendantsInstance = Tool.Parent
--TEAM = Character:FindFirstChild("TEAM")
if Module.DualEnabled and Workspace.FilteringEnabled then
Handle2.CanCollide = false
local LeftArm = Tool.Parent:FindFirstChild("Left Arm")
local RightArm = Tool.Parent:FindFirstChild("Right Arm")
if RightArm then
local Grip = RightArm:WaitForChild("RightGrip",0.01)
if Grip then
Grip2 = Grip:Clone()
Grip2.Name = "LeftGrip"
Grip2.Part0 = LeftArm
Grip2.Part1 = Handle2
--Grip2.C1 = Grip2.C1:inverse()
Grip2.Parent = LeftArm
end
end
end
end)
Tool.Unequipped:connect(function()
if Module.DualEnabled and Workspace.FilteringEnabled then
Handle2.CanCollide = true
if Grip2 then Grip2:Destroy() end
end
end)
MuzzleEvent.OnServerEvent:Connect(function(ClientThatFired, MuzzleFlashEnabled, MuzzlePointObject, MuzzleLightData)
local function spawner1()
local C = script:WaitForChild("MuzzleEffect"):GetChildren()
for i=1,#C do
if C[i].className == "ParticleEmitter" then
local count = 1
local Particle = C[i]:Clone()
Particle.Parent = MuzzlePointObject
if Particle:FindFirstChild("EmitCount") then
count = Particle.EmitCount.Value
end
delay(0.01,function()
Particle:Emit(count)
game.Debris:AddItem(Particle,Particle.Lifetime.Max)
end)
end
end
end
if MuzzleFlashEnabled then
spawn(spawner1)
end
if MuzzleLightData[1] then
local Light = Instance.new("PointLight")
Light.Parent = MuzzlePointObject
Light.Brightness = MuzzleLightData[2]
Light.Color = MuzzleLightData[3]
Light.Enabled = true
Light.Range = MuzzleLightData[4]
Light.Shadows = MuzzleLightData[5]
game.Debris:addItem(Light,MuzzleLightData[6])
end
end)
MouseEvent.OnServerEvent:Connect(function(ClientThatFired, MouseDirection, FirePointObject)
Fire(MouseDirection, FirePointObject)
end)
Caster.LengthChanged:Connect(OnRayUpdated)
Caster.RayHit:Connect(OnRayHit)
I think you need to allowed the sound to your game or your studio settings volume is 0
Sounds are taked from toolbox. Also how to allow sounds to my game?
Did you try clicking play sound on the explorer
Tell me if you hear nothing
I hear gunshot. Only other player on server don’t hear anything from gun system
Hmm, its not localScript right?
I don’t think so. It used to work few months ago and I didn’t change anything
Something is probably wrong with your concatenation when defining the sound ID maybe add “” around the concat or add another space is but that’s probably the source of the issue.
I don’t know why but I think you need RemoteEvents
So just to make sure you said it was a server script right. Well if it is then you can’t define Char Hum or Plr you need a remote event from a local script that carry those vars
What if exploiters fires the RemoteEvent?
Idk I’m not into anti cheaty stuff
I think I fixed a problem. Can someone join to testing place?