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

If the player enters the smoke it won't kill them only if the smoke spawns. What is needed?

Asked by 7 years ago
-- 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)

0
When I shoot it near my feet, it will kill me. If I walk into the smoke it will not kill me. JoshWplaysRoblox 10 — 7y
0
It's a ray so it only fires once meaning you can't walk into it..how I solved this probably is by firing multiple rays with a for loop however that could get a bit laggy for you SHDrivingMeNuts 299 — 7y

Answer this question