Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Puddle Widening on new position of NPCs Body after death, can anyone help?

Asked by
IrishFix 124
5 years ago
Edited 5 years ago

I want to have this "puddle" spread outward and i have made it work when the NPC it is in dies, it spreads randomly outward in seperate places, but once the npc has flown away or slid from the attack, the puddle is at least 10 studs away from the body. I have tried to make it spawn on the general position of the Humanoid root part on the NPC, but it wont do it. Maybe one of you smarter people could help out. All help appreciated! EDIT: I need for this code to work still, but execute at the position of the dead NPCs body. Code:

local Char=script.Parent
local Hum=Char:WaitForChild("Humanoid")
local Tor=Char:WaitForChild("Torso")
local M=math.random
local R=math.rad
local rates={0.05,0.075,0.1,0.15}

local smooth=function(P)
local SM=Enum.SurfaceType.SmoothNoOutlines
P.TopSurface=SM
P.BottomSurface=SM
P.RightSurface=SM
P.LeftSurface=SM
P.FrontSurface=SM
P.BackSurface=SM    
end

local function BloodPool(Part,Size)
local Pool=Instance.new("Part",game.Workspace)
Pool.TopSurface=0
Pool.CanCollide=false
Pool.BrickColor=BrickColor.new("Dusty Rose")
Pool.Material = "Glass"
Pool.Transparency = 0.5
Pool.CanCollide = false
Instance.new("CylinderMesh",Pool)
Pool.Anchored=true
Pool.Name="BloodPoolPart"
smooth(Pool)
Pool.FormFactor=Enum.FormFactor.Custom
Pool.Size=Size


local c=Part.CFrame*CFrame.new(M(-3.01,3.01),-2.9,M(-3.01,3.01))    
coroutine.resume(coroutine.create(function()
local rate=rates[M(1,#rates)]
wait(2)
game.Debris:AddItem(Pool,15)
for i=1,M(25,70) do
wait()
Pool.CFrame=c
Pool.Size=Pool.Size+Vector3.new(rate,0,rate)
end 
wait(5)
Pool:Destroy()
end))   
end

local function BloodDrops(Size,Area)
local Blood=Instance.new("Part",game.Workspace)
Blood.BrickColor=BrickColor.new("Crimson")
Blood.TopSurface=0
Blood.CanCollide=false
Blood.Anchored=false
Blood.FormFactor=Enum.FormFactor.Custom
Blood.Size=Size
Blood.CFrame=Area*CFrame.new(M(-1.00,1.00),M(-1.00,1.00),M(-1.00,1.00))     
return Blood
end


local Heath=Hum.Health

Hum.Changed:connect(function()
if Hum.Health<Heath then
Heath=Hum.Health        
for i=1, math.random(4,10)do
local Size=Vector3.new(M(-0.25,0.25),.05,M(-.25,.25))
local Blood=BloodDrops(Size,Tor.CFrame) 
local Stopper=false
local Size2=Vector3.new(M(-0.25,0.25),.05,M(-.25,.25))
BloodPool(Tor,Size2)
end 
end
end)

Answer this question