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

Is There A Way To Make A Casting Ray Bigger So I Wont Have To Put Multiple Rays?

Asked by 6 years ago

Im trying to make a kamehameha but when i use touch interest its laggy, region3 is glitchy and hits player when beam dont even hit them, and i dont know how to use magnitude so it gets the size of the beam. I also tried :gettouchingpart() but u have to have cancollide = true and players dont go in beam

Heres the code

start1 = script.Parent
end1 = script.Parent.Part
function castRay()


    local ray = Ray.new(
   start1.Position,                           -- origin
    (end1.Position - start1.Position).unit * (200) -- direction
    ) 
    local ignore = game.Players.LocalPlayer.Character

    local hit, position = workspace:FindPartOnRay(ray, Player.Character, false, true)
    if hit then

    if hit.Parent:FindFirstChild("Humanoid") ~= nil then

        damage = Player.Data.Level.Value

        humanoid = hit.Parent:FindFirstChild("Humanoid")
        torso = hit.Parent:FindFirstChild("LowerTorso")
        humanoid.Health = humanoid.Health - damage*10
        body = Instance.new("BodyVelocity",torso)
        body.Velocity = root.CFrame.lookVector*10
game.Debris:AddItem(body,0.1)

    end
    end
end
0
I'm pretty sure a ray in geometry cannot be bigger, so why would a ray in ROBLOX be bigger than just a infinite line? hiimgoodpack 2009 — 6y
0
just use an invisible part along the ray? rays are practically very small (if at all have any size / N/A) so maybe using a part would help? abnotaddable 920 — 6y
0
But that wouldn't detect the first part detected from a object going from the player to the part hiimgoodpack 2009 — 6y

Answer this question