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.
– 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)
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 …
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
"
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
game:GetService(“TagService”):GetTagged(“YourTagHere”)[1].Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
– play sound effect here
end
end)
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