alright so as the question says my :FindPartOnRayWithIgnoreList()
is not ignoring the LocalPlayer's Character and the function is supposed to ignore all Descendants of given value
LocalScript:
local camera = workspace.CurrentCamera local anim = Instance.new("Animation") local id = 04675084449 local name = "DestPart" anim.AnimationId = "http://www.roblox.com/Asset?ID="..id local tool = script.Parent local plr = game.Players.LocalPlayer local Character = plr.Character or plr.ChildAdded:Wait() local deb = false local canhit = false local Event = game.ReplicatedStorage.Break local ignore = {Character} tool.Activated:Connect(function(mouse) if deb == false then deb = true local viewportPoint = camera.ViewportSize / 2 local unitRay = camera:ViewportPointToRay(viewportPoint.X, viewportPoint.Y, 0) local ray = Ray.new(unitRay.Origin, unitRay.Direction * 20) local part, position = workspace:FindPartOnRayWithIgnoreList(ray,ignore) local animcont = plr.Character.Humanoid:LoadAnimation(anim) animcont:Play() if part then print(part:GetFullName()) if part:IsA("Part") or part:IsA("MeshPart")or part:IsA("UnionOperation") then if part.Name == "DestPart" then if canhit == true then Event:FireServer(part) end end end end deb = false end end)
Line 8 seems to be wrong; it should be CharacterAdded
, not ChildAdded