there is script
local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
local runService = game:GetService("RunService")
local tweenService = game:GetService("TweenService")
local player = players.LocalPlayer
local events = replicatedStorage.Events
local configs = require(replicatedStorage.Modules.Gun_Controller.Gun_Configs)
local tool = script.Parent
local config = configs.Pistol_Config
local bullets = {}
local function Bullet(Position, Direction)
local part = Instance.new("Part")
part.Parent = workspace.Misc
part.CFrame = CFrame.lookAt(Position, Position + Direction) * CFrame.new(0,0,-1000)
part.Anchored = true
part.Size = Vector3.new(0.25, 0.25, 2000)
part.BrickColor = BrickColor.Yellow()
part.CanCollide = false
part.CanTouch = true
part.Material = Enum.Material.Neon
local tween = tweenService:Create(part, TweenInfo.new(.25), {Transparency = 1})
tween:Play()
task.defer(function()
tween.Completed:Wait()
part:Destroy()
end)
local run
end
local lastFired = 0
tool.Activated:Connect(function()
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {player.Character, tool, workspace.Misc}
local direction = (player:GetMouse().Hit.Position - tool.FirePart.Position).Unit
local result = workspace:Raycast(tool.FirePart.Position, direction * 1000, params)
Bullet(tool.FirePart.Position, direction* 10)
if result then
local instance = result.Instance
if instance.Parent:FindFirstChildOfClass("Humanoid") then
print(instance.Parent, instance)
end
end
end)
and how its looks
https://medal.tv/games/roblox-studio/clips/mhDnWSgOAFjY-GKLk?invite=cr-MSxlNnEsMjk5Mzc2OTM3&v=9
Watch Untitled by kwax and millions of other Roblox Studio videos on Medal. #robloxstudio
