Hello, as the title suggests I have an issue with Mouse.TargetFilter, I need this for my placement system
but the model will fly directly to the camera
Is there any way to fix this without using raycasting?
First Script
if towerButton:IsA("TextButton") then
towerButton.MouseButton1Click:Connect(function()
local PreviewTower = game.ReplicatedStorage.Towers:FindFirstChild(towerButton:WaitForChild("TowerEquipped").Value):Clone(); PreviewTower.Parent = workspace;
for _, BasePart in pairs(PreviewTower:GetDescendants()) do
if BasePart:IsA("BasePart") then
BasePart.Material = Enum.Material.ForceField
BasePart.CanCollide = false
end
end
RunService.RenderStepped:Connect(function()
PreviewTower:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.X,mouse.Hit.Y + (PreviewTower.PrimaryPart.Size.Y + 0.5),mouse.Hit.Z))
mouse.TargetFilter = PreviewTower
end)
mouse.Button1Down:Connect(function()
local tower = game.ReplicatedStorage.Towers:FindFirstChild(PreviewTower.Name):Clone(); tower.Parent = workspace
tower:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.X,mouse.Hit.Y + (PreviewTower.PrimaryPart.Size.Y + 0.5),mouse.Hit.Z))
end)
end)
end
end``