I was attempting to make a kill effect happen when for example, a player’s sword kills a player/humanoid, for my game. I had a few issues, mostly the script not working.
The secondary code is for the SCS script, which should be contained within the character, so no infinite yields should be occurring. (unless there is an error)
I have a theory that maybe SwordScript dumps its contents into the victim’s Humanoid? But that’s just a guess, we have no confirmation since we don’t know what’s in SwordScript
Did you modify the code yourself? Because KillScript isn’t going into the victim’s character.
Try putting the code directly into your SCS script
e.g.
local Humanoid = script.Parent:WaitForChild("Humanoid")
local character = script.Parent
Humanoid.Died:Connect(function()
for _,v in pairs(character:GetChildren()) do -- Code added here
if v:IsA("BasePart") or v:IsA("Accessory") then
v:Destroy()
end
end -- End of added code
end)
Is there any way this can be set to be used for an individual sword? For example, one sword kills the player, and they disappear. The other sword (without the script) doesn’t make the player disappear.
local Disappear = true --at the top of your script, you can change this value
Humanoid.Died:Connect(function()
if Disappear == true then
for _, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") or v:IsA("Accessory") then
v:Destroy()
end
end
end
end)