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

How to make ray casting bullet stop at hit target?

Asked by 3 years ago
Edited 3 years ago

So i'm trying to make a script that shoots a bullet whenever the gun fires, but I dont know how to make it so that the bullet stops at the hit target

01local tool = script.Parent
02local Handle = tool:WaitForChild("Handle")
03local Shoot = tool:WaitForChild("Shoot")
04 
05local Debris = game:GetService("Debris")
06 
07local range = 100
08 
09local damage = 20
10local headshotDamage = 40
11 
12Shoot.OnServerEvent:Connect(function(Player, mousePos, originPos)
13    local Character = Player.Character
14    local Humanoid = Character:WaitForChild("Humanoid")
15 
View all 55 lines...
0
I dont quite understand what the bullet and rsycast does. Does the bullet go to the end point (hitbposition) of raycast or does it point towards the hit position and constantly move in that direction? AlexanderYar 788 — 3y

Answer this question