Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

(SOLVED) How do I make a sound play if a player kills another player?

attempted to make a kill confirmed type of thing. No error and I cant figure out what to do.

script that detects if that player shot dies (local script in a GUI)

[I have another script similar to this, but it's a kill cam. Thinking I can modify what I made to make a sound when that player kills someone]:

local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

hum.Died:Connect(function(killed)
	local killer = char.Humanoid:FindFirstChild("creator")
	if killer.Value then
		game.ReplicatedStorage.SOUND2:FireServer(killer)

	end
end)

script that got fired: (server script, in a GUI)

game.ReplicatedStorage.SOUND2.OnServerEvent:Connect(function(killer)
	local killer = killer.Humanoid:FindFirstChild("creator")
	if killer.Value then
		script.Parent.Sound2:Play()
	end
end)

2 comments

0

What is the sound parented to?

0

the sound is in the GUI. aka outside of the script that got fired

1 answer

Answer: A friend of mines helped me with this, created another script that shows who damaged that player, and who killed them.

This discussion is preserved as it was. New answers, comments, and votes are closed.