How to make a kill sound gamepass like combat warriors?

In combat warriors theres a custom kill sound gamepass that plays when you get a kill. To select a kill sound players go to settings and input the id.

How would I make a gamepass like this where when a player gets a kill, the sound they picked plays?

2 Likes

The player would have a kill sound. In this case in the char or player GUI. So each player heasr just that sound. The sound object has a sound ID in it. You could script in a ID change based off what they pick. NameofSound.SoundId = “rbxassetid://00000” … Once the sound ID is set that is the sound it will play for them each time they die.

1 Like

Can you elaborate on all of this?

1 Like

Something like this?

– Create a remote event to send the selected sound ID from the client to the server
local remoteEvent = Instance.new(“RemoteEvent”)
remoteEvent.Name = “SelectedKillSound”
remoteEvent.Parent = game.ReplicatedStorage

– When a player gets a kill, send their selected sound ID to the server
function onKill(player, soundID)
remoteEvent:FireServer(player, soundID)
end

– Connect the onKill function to the kill event
game:GetService(“ReplicatedStorage”).Events.KillEvent.OnServerEvent:Connect(onKill)

– On the server, play the selected sound when a player gets a kill
remoteEvent.OnServerEvent:Connect(function(player, soundID)
local selectedSound = game:GetService(“SoundService”):FindFirstChild(“Sound_”…soundID)
if selectedSound then
selectedSound:Play()
end
end)

2 Likes

Looks like you got the ideal. Just going to need to test a few ways of doing that now.
Keep in mind the SoundId is a string. Search “How to make a Custom Death Sound in Roblox Studio”. Came up with 4-5 videos for that …

1 Like

One idea I had was using the creator tag method. You know how games use creator tags to give currency on kills? I wonder if I can somehow use that creator tag system for making the kill sounds play

1 Like

This should be a solution.

"
local MarketplaceService = game:GetService(“MarketplaceService”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

local KillSound = ReplicatedStorage:WaitForChild(“KillSound”)
local GamePassID = 123456789 – Change this to the ID of your game pass

game.Players.PlayerAdded:Connect(function(player)
local hasGamePass = false

local success, message = pcall(function()
	hasGamePass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamePassID)
end)

if not success then
	warn("Error while checking if player has game pass: " .. tostring(message))
end

if hasGamePass then
	-- The player has the game pass
	-- Add code here to play the kill sound when the player makes a kill
	local function onPlayerKill()
		local sound = KillSound:Clone()
		sound.Parent = player.Character.Head
		sound:Play()
	end

	-- Connect the onPlayerKill function to an event that is fired when the player makes a kill
end

end)

2 Likes

yeah i guess hopefully the test goes successfully!

1 Like

It is possible to do that i think.

game:GetService(“TagService”):GetTagged(“YourTagHere”)[1].Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
– play sound effect here
end
end)

3 Likes

Yeah I could modify that even more. I can also have it check if the humanoid’s health they’re hitting’s health = 0, if so it’ll play the sound

2 Likes

I see you already got them scripts …

2 Likes

So could I combine this and this (How to make a kill sound gamepass like combat warriors? - #9 by shawndevlin115) to make it? That way when a player dies it’ll play the sound of the creator aka the person who killed them for everyone.

Sorry for the late response but this should make the sound play for everyone in the game.

local MarketplaceService = game:GetService(“MarketplaceService”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local Debris = game:GetService(“Debris”)

local KillSound = ReplicatedStorage:WaitForChild(“KillSound”)
local GamePassID = 123456789 – Change this to the ID of your game pass

game.Players.PlayerAdded:Connect(function(player)
local hasGamePass = false

local success, message = pcall(function() hasGamePass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamePassID)end)
if not success then
	warn("Error while checking if player has game pass: " .. tostring(message))
end
if hasGamePass then
	local function onPlayerKill()
		local sound = KillSound:Clone()
		Debris:AddItem(sound, 1)
		sound:Play()
	end
	-- this is conncecting the onPlayerKill function to an event that is fired when the player makes a kill
end

end)

1 Like