Raycast offset doesnt work?

Hey, so i made a raycast script, but random offset for spread doesnt seem to work? I copied it from one of my old games where it works, but here uh… yeah it just doesnt.
Local script:

Local script:

local tool = script.Parent
local gui = tool.Desc
tool.Equipped :Connect(function()
	gui.Parent = game.Players.LocalPlayer.PlayerGui.Stats
end)
tool.Unequipped:Connect(function()
	gui.Parent = tool
end)

local dmg = 22
local spread = 5
local lenght = 99999

local fireRemote = game.ReplicatedStorage.Remotes.Raycast


local camera = workspace.CurrentCamera
local cameraCF = camera.CFrame



tool.Activated:Connect(function()
	
	
	local camera =workspace.CurrentCamera
	local cameraCF = camera.CFrame
	local Offset = Vector3.new(
		math.random(-100,100),
		math.random(-100,100),
		math.random(-100,100)
	)/100 * 0.25
	fireRemote:FireServer(cameraCF.Position,(cameraCF.LookVector * lenght)+Offset,dmg,tool)
	print(Offset)
	
end)

Server script:

hitscan.OnServerEvent:Connect(function(plr,pos,dir,dmg,tool)
	print("REMOTE RECEIVED")
	local params = RaycastParams.new()
	params.FilterType = Enum.RaycastFilterType.Exclude
	params.FilterDescendantsInstances = {plr.Character,game.Workspace.HitIndics}
	local result = workspace:Raycast(pos,dir,params)
	if result then
		print(result.Instance.Name)
		local visualizer = game.ReplicatedStorage.HitVisualizer:Clone()
		visualizer.Parent = game.Workspace.HitIndics
		task.wait()
		visualizer.Script.Enabled = true
		visualizer.Start.WorldPosition = plr.Character:FindFirstChildWhichIsA("Tool").Handle.FiringPoint.WorldPosition
		visualizer.End.WorldPosition = plr.Character:FindFirstChildWhichIsA("Tool").Handle.FiringPoint.WorldPosition

		local goal = {}
		goal.WorldPosition = result.Position
		local tweeninfo = TweenInfo.new(0.12)
		local tween = TS:Create(visualizer.End,tweeninfo,goal)
		tween:Play()

		local goal = {}
		goal.WorldPosition = result.Position
		local tweeninfo = TweenInfo.new(0.5)
		local tween = TS:Create(visualizer.Start,tweeninfo,goal)
		tween:Play()
		
		if result.Instance.Parent:FindFirstChildWhichIsA("Humanoid") then
			soundSpawner.SpawnSound("rbxassetid://2640194863",result.Instance,3,1)
			local particleCLone = game.ReplicatedStorage.Particles.Hit:Clone()
			particleCLone.Parent = result.Instance
			particleCLone:Emit()
			result.Instance.Parent:FindFirstChildWhichIsA("Humanoid").Health -= tool:GetAttribute("dmg")
		else
			applyEffect(result)
		end
	end
end)

Bullets hit the same spot, always exactly where you aim

This is the wrong category. Please post on #help-and-feedback:scripting-support

1 Like