alrighty mctighty so this this script right here is supposed to give the player who killed another player a set amount of "Coins" which works fine when a player kills a "Dummy" but on the second elseif statment it always returns Failed ive got it to work before but it would award when you kill yourself also which obviously is not wanted and i have tried rescripting this many times i cant cant figure out exactly what i need here, oh so when a player "summons" a bomb it creates a string value inside the explosion that is what obj.Owner is and its value is set to the players name
script:
workspace.ChildAdded:Connect(function(obj)
if obj:IsA("Explosion") then
obj.Hit:Connect(function(basePart)
if basePart.Name == nil then
else
print(basePart.Name)
end
if basePart.Name == "BlueBarrel" or basePart.Name == "RedBarrel" then
local name = obj.Owner.Value
local player = game.Players:FindFirstChild(name)
print(name.." Killed "..basePart.Name)
basePart:Destroy()
elseif basePart.Parent.Name == "Dummy" and basePart.Name == "HumanoidRootPart" then
local name = obj.Owner.Value
local player = game.Players:FindFirstChild(name)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50
basePart.Parent:Destroy()
pcall(function()
print(name.." Killed "..basePart.Parent.Name)
end)
elseif basePart.Name == "HumanoidRootPart" then
warn("Performing Heredity Check")
local name = obj.Owner.Value
local player = game.Players:FindFirstChild(name)
if basePart.Parent.Name == not player.Name then
warn("Heredity Check Success")
local otherPlayer = game.Players:GetPlayerFromCharacter(basePart.Parent)
local otherHumanoid = otherPlayer.Character.HumanoidRootPart
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50
pcall(function()
print(name.." Killed "..otherPlayer)
end)
else
warn("Heredity Check Failed")
end
end
end)
end
end)
