If the player enters the smoke it won't kill them only if the smoke spawns. What is needed?
-- Configs
local tool = script.Parent
local player = game.Players.LocalPlayer
mouse = player:GetMouse()
--------------------------------------------------------------------------
tool.Equipped:connect(function()
mouse.Button1Down:connect(function()
local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
local gas = Instance.new("Part",workspace)
gas.Transparency = 0.4
gas.Anchored = true
gas.CanCollide = false
gas.Shape = "Ball"
gas.Size = Vector3.new(.4,.4,.4)
gas.BottomSurface = 0
gas.TopSurface = 0
local Smokey = Instance.new("Smoke",gas)
Smokey.Size = 10
local distance = (tool.Handle.CFrame.p - position).magnitude
gas.Size = Vector3.new(0.3, 0.3, distance)
gas.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
game:GetService("Debris"):AddItem(gas, 5)
distance = (gas.Position - player.Character.Humanoid.Torso.Position).magnitude
while true do
if distance < 10 then
game.Players.LocalPlayer.Character.Humanoid.Health = 0
wait (1)
end
end
end)
end)