So i want to make a shield with a gun that uses raycast but i've never seem to figure out how to do this?
Raycast script:
function localBullet()
local Raycast = Ray.new(Tool.BPoint.CFrame.p, (PMouse.Hit.p - Tool.BPoint.CFrame.p).unit * BulletDistance)
local Part, Position = game.Workspace:FindPartOnRay(Raycast, Player.Character, false, true)
local Distance = (Tool.BPoint.CFrame.p - Position).magnitude
local Bullet = Instance.new("Part", game.Workspace)
Shell.Parent = game.Workspace
if Part ~= nil and Part ~= "HumanoidRootPart" then
if Part.Parent ~= nil and Part.Parent:FindFirstChild("Humanoid") then
Part.Parent:FindFirstChild("Humanoid").Health = Part.Parent:FindFirstChild("Humanoid").Health - Damage
elseif Part.Parent.Parent ~= nil and Part.Parent.Parent:FindFirstChild("Humanoid") then
Part.Parent.Parent:FindFirstChild("Humanoid").Health = Part.Parent.Parent:FindFirstChild("Humanoid").Health - Damage
elseif Part.Parent.Parent.Parent ~= nil and Part.Parent.Parent.Parent:FindFirstChild("Humanoid") then
Part.Parent.Parent.Parent:FindFirstChild("Humanoid").Health = Part.Parent.Parent.Parent:FindFirstChild("Humanoid").Health - Damage
end
end

7 comments
And this is my first time posting, so forgive me if i made some mistake on this post.
There's a tutorial on the official Roblox Dev Wiki
Edit:- fixed codeblock
The tutorial he was talking about: https://developer.roblox.com/en-us/articles/Making-a-ray-casting-laser-gun-in-Roblox
What exactly are you asking for, the code looks okay to me. Are you asking for the shield to deflect bullets?
Yes, i'm asking for a shield that can deflect raycast bullets.
See the comments for explaination