local Jerry = game.Players.LocalPlayer:GetMouse() --Localscript
local tool = script.Parent
local origin = script.Parent.meGun.Origins
local debounce = false
local cooldown = 0.2
Jerry.TargetFilter = game.Workspace.Laseronias
Jerry.TargetFilter = origin
script.Parent.Activated:Connect(function()
if debounce then return end
debounce = true
local jerryPos = Jerry.hit.p
local oPos = origin
game.ReplicatedStorage.RemoteEvent:FireServer(jerryPos,oPos)
wait(cooldown)
debounce = false
end)
local debris = game:GetService("Debris")
--This is the Server Script
local function shootbullet(origin,direction,ting)
local part = Instance.new("Part")
part.Parent = game.Workspace.Laseronias
part.Material = Enum.Material.Neon
part.BrickColor = BrickColor.new("Gold")
part.Size = Vector3.new(0.1,0.1,0.1)
part.Anchored = true
part.CanCollide = false
part.Position = origin.Position
local startPos = part.Position
for i = 0,1,0.1 do
wait()
part.Position = startPos:Lerp(ting,i)
print("moved")
print(ting)
end
end
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,jP,oP)
local DEST = (jP-oP.Position).Unit * 999
local tikn = (jP-oP.Position)
local Res = workspace:Raycast(oP.Position,DEST)
local resPart = Res.Instance
if Res then
print(Res.Instance.Name)
if resPart.Parent:FindFirstChild("Humanoid") and resPart.Parent:FindFirstChild("Humanoid") ~= player.Character:FindFirstChild("Humanoid") then
resPart.Parent:FindFirstChild("Humanoid"):TakeDamage(100)
end
end
shootbullet(oP,DEST,tikn)
end)
So basically where the bullet fires is inaccurate. Here is a clip of what happens: https://gyazo.com/54046a0d5c313f3f7b899ec651476b7c

1 comment
maybe use raycasting