Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to create clicking part without click detectors?

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!

1 comment

0

You can use raycasting to detect what the user has clicked on in the world space

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.