so i got this script that damages players, and makes a part that welds to the damaged player then the part welds to your hand, and its just used for looks but it doesn't work on players at all. It works on npcs 100% of the time but for players it completely ignores them and just does the damage part. Heres a stripped down version of my code:
001 | local Part = enemyplayer.Character.HumanoidRootPart --(placeholder) |
002 | local player = Nikkted -- me |
003 | local humanoidRootpart = Nikkted.Character.HumanoidRootPart |
004 |
005 | spawn( function () |
006 | local explosionPart = Instance.new( "Part" , player.Character) |
007 | explosionPart.Parent = player.Character |
008 | explosionPart.Anchored = false |
009 | explosionPart.Massless = true |
010 | explosionPart.CanCollide = false |
011 | explosionPart.Size = Vector 3. new( 0.616 , 0.104 , 30 ) |
012 | explosionPart.BrickColor = BrickColor.new( "New Yeller" ) |
013 | explosionPart.Material = Enum.Material.Neon |
014 | explosionPart.Transparency = 0 |
015 | explosionPart.CFrame = player.Character.HumanoidRootPart.CFrame*CFrame.new( 0 , 1 ,- 89 ) |
i don't see where the barrier between whats a player and whats an npc stops it from working on players is it because welding players to players doesn't work or something? idk if I'm missing something but I hope you guys could help me out <3
I Found This Script In A Zombie it works, If You Want To Change Costume Then Just Add Different Heads etc. local zombie = script.Parent
for _, script in pairs(zombie.ModuleScripts:GetChildren()) do if not game.ServerStorage:FindFirstChild(script.Name) then script:Clone().Parent = game.ServerStorage end end
local AI = require(game.ServerStorage.ROBLOX_ZombieAI).new(zombie) local DestroyService = require(game.ServerStorage.ROBLOX_DestroyService)
local function clearParts(parent) for _, part in pairs(parent:GetChildren()) do clearParts(part) end local delay if parent:IsA("Part") then delay = math.random(5,10) else delay = 11 end DestroyService:AddItem(parent, delay) end
zombie.Humanoid.Died:connect(function() AI.Stop() math.randomseed(tick()) clearParts(zombie) script.Disabled = true end)
local lastMoan = os.time()
math.randomseed(os.time())
while true do
local animationTrack = zombie.Humanoid:LoadAnimation(zombie.Animations.Arms)
animationTrack:Play()
-- local now = os.time()
-- if now - lastMoan > 5 then
-- if math.random() > .3 then
-- zombie.Moan:Play()
---- print("playing moan")
-- lastMoan = now
-- end
-- end
wait(2)
end
`