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

How to make PlayerMouse ignore a part?

Asked by
Mokiros 135
9 years ago

I have LocalScript in StarterPlayerScripts, which creates a part and player can control it with mouse. But i have 1 problem - when i run the game, mouse is overlapping part, and part is moving to camera because mouse position on the part.

Here is the script:

plr = game:GetService("Players").LocalPlayer

--Creating a brick
holo = Instance.new("Part", workspace.CurrentCamera)
holo.Transparency = 0.5
holo.Size = Vector3.new(4,4,4)
holo.Anchored = true
holo.CanCollide = false
holo.Material = Enum.Material.SmoothPlastic

--Moving a brick; this is the problem
while true do
    wait(0.1)
    local Mouse = plr:GetMouse()
    holo.CFrame = CFrame.new(Mouse.Hit.p)
end

1 answer

Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

My solution to this was to use the Dragger object to control object dragging, but another solution is to put it inside of your character.

Ad

Answer this question