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

How to create clicking part without click detectors?

Asked by 5 years ago

I believe there should be some way to to make a “custom ClickDetector” withot using the Roblox ClickDetector, when you click on a brick, it will reacts something. Thanks!

0
You can use raycasting to detect what the user has clicked on in the world space aazkao 787 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Yes you can. With the use of the mouse you can do this. The mouse has a Target property which will hold a reference to the part the mouse is hovering over, nil if no part is being hovered over.

-- Local Script

local UserInputService = game:GetService("UserInputService")
local mouse = game:GetService("Players").LocalPlayer:GetMouse()

UserInputService.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        print(mouse.Target)
    end
end)

Just an example on how you would do it. I encourage you to do some research on your own next time.


Hopefully this answered your question, and if it did, then don't forget to hit that "Accept Answer" button. It helps both of us out :) If you have any more questions then feel free to leave them down in the comments.
Ad

Answer this question