So, recently i had the idea of adding death effects to my game and was wondering how i could do that? How do i put a system so that when you kill someone lets say with just the “Classic Sword” itll register that “Player A” killed “Player B”… also when “Player A” kill the other player i wanna know how i can alter “Player B’s” body model… any suggestions?
I think the classic sword uses the Humanoid Tag method
when a humanoid dies check inside of it for an ObjectValue named ‘creator’ its value will be the killer’s player instance.
Humanoid.Died:Connect(function()
local creator = Humanoid:FindFirstChild('creator')
if creator and creator.Value then
local killer = creator.Value
-- do something with the killer
end
end)
local sword = sword -----handle of tool
sword.Touched:Connect(function(hit)
if game.Players:FindFirstChild(hit.Parent.Name) then
if hit.Parent.Humanoid.Health <= sworddamage then
start effect----
end
end
end)
local sword = script.Parent.Handle
sworddamage = 50
sword.Touched:Connect(function(hit)
if game.Players:FindFirstChild(hit.Parent.Name) then
if hit.Parent.Humanoid.Health <= sworddamage then
hit.Parent.Head:Destoy()
--test effect
end
end
end)
im using the same script as you, but obviously i modified it to adapt to my case.
well looks like you dont know how to type destroy()
local sword = script.Parent.Handle
sworddamage = 50
script.Parent.Equipped:Connect(function()
local eq = true
sword.Touched:Connect(function(hit)
if eq == true then
if game.Players:FindFirstChild(hit.Parent.Name) or hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Humanoid.Health <= sworddamage or hit.Parent.Humanoid.Health >= 0 then
hit.Parent.Head:Destroy()
print("rip")
end
end
end
end)
end)