i want the raycast to go through (ignore) the player and all parts in the tool
it also doesnt print the parts in the table (v), it just prints b like 30 times
this is a local script in starter player scripts
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local targetPart = workspace:WaitForChild("bullet")
local tyronegun = script.Parent.Parent.Backpack.TyroneGun
local gunevent = game.ReplicatedStorage.fireevent
local gunend = tyronegun.GunEnd
local size
local targethit
local character = player.Character or player.CharacterAdded:Wait()
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
paramtable = {game.Workspace.window, game.Workspace.window2}
for i, v in pairs(tyronegun:GetChildren()) do
if v:IsA("Part") then
table.insert(paramtable, v)
end
end
for i, v in pairs(character:GetChildren()) do
if v:IsA("MeshPart") then
table.insert(paramtable, v)
end
end
print("bvox")
for i, v in pairs(paramtable) do
print("b")
print(v)
end
params.FilterDescendantsInstances = paramtable
local function updatePartOrientation()
local mousePosition = mouse.Hit.Position
targetPart.CFrame = CFrame.lookAt(targetPart.Position, mousePosition)
orientation = targetPart.Orientation
local direction = mousePosition - gunend.Position
raycastResult = workspace:Raycast(gunend.Position, direction, params)
if raycastResult then
size = raycastResult.Distance
end
end
tyronegun.activated:Connect(function()
print("function fired")
print(raycastResult)
gunevent:FireServer(orientation, size)
end)
RunService.RenderStepped:Connect(updatePartOrientation)