Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with Mouse.TargetFilter?

Asked by 9 years ago

The Part keeps won't ignore the Character,I already put the target filter to character but it won't work.Why?

-- 6/10/2015  By:Zobomafoo
--Purpose:Creates a movable model using rays and mouse events

--[[Setup]]--

Player = game.Players.LocalPlayer
-------------------------------
Vairables = {
    Part = game.ServerStorage.Part,
    Mouse = Player:GetMouse()}
-------------------------------
Functions = {
    CreateRay = function(IgnorePart)
    local Ray = Ray.new(Vairables.Mouse.UnitRay.Origin,Vairables.Mouse.UnitRay.Direction*900)--Create ray from mouse and reaches 900 studs max
    local Hit,Pos = game.Workspace:FindPartOnRay(Ray,IgnorePart)--Ray,PartIgnoredByRay
    return Hit 
end}
-------------------------------
ClonedPart = Vairables.Part:Clone()
ClonedPart.Parent = game.Workspace

 --~~--~~[[Everything starts here]]~~--~~---
    Vairables.Mouse.TargetFilter = Player.Character
     Vairables.Mouse.Move:connect(function()
         local Hit = Functions.CreateRay(ClonedPart)
         if  Hit then -- if hit then do the following
         ClonedPart:MoveTo(Vairables.Mouse.Hit.p)
         end
     end)
 -----------------------------------------
     Vairables.Mouse.Button1Down:connect(function()
         local NewPart = ClonedPart:Clone()
         NewPart.Parent = game.Workspace
     end)


Why won't it work and how do I fix it?

0
In what way is it not working? How does the cloned part behave? Redbullusa 1580 — 9y
0
If you put the part close to the character it won't ignore the the character it will float around it.I just want to stay put in the ground. kevinnight45 550 — 9y

Answer this question