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

How can you make a part clickable without a click detector?

Asked by 7 years ago

I'm working on a game, and in order to advance you have to find clues and such, which will probably be just different objects/model around the area. I don't want the game to be a "Search for the click mouse icon", but rather a game where you actually have to think and observe everthing around you.. I know there's a way to do this, but I cant find out how.

I'd appreciate either a YouTube video or a Wiki link. Example code would be nice, but it would also be nice to learn by myself via the wiki if possible.

0
You would want to make custom names for the clickable parts. On the client end you would want to get a hold of when a player's mouse clicks and what the name of the object they clicked is. Then you would fire an event to the server indicating what objects the player had clicked on. M39a9am3R 3210 — 7y
0
That's just a general concept, but I am sure someone can go into more detail for you. M39a9am3R 3210 — 7y

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

You could use the Button1Down event of the Mouse object, and then check the Target property.

Code would look similar to this..

local plr = game.Players.LocalPlayer;
local mouse = plr:GetMouse();
local whiteList = {"Clue1";"Clue2";"Clue3";"Clue4";"Clue5"};

mouse.Button1Down:Connect(function()
    local obj = mouse.Target;
    for _,v in next,whiteList do
        if v == obj.Name then
            print(v.." found!");
        end
    end
end)

You may also combine this with the Move event for implementing a 'hovering' effect over objects.

0
Alright, i'll definitely try this out. I had no idea the Mouse was an thing you can get via the player (I'm better at the more simple things, not the very complicated things) Tempestatem 884 — 7y
0
Update note, thanks so much. This opens so many new doors for me, i can do so much more! Tempestatem 884 — 7y
0
No problem :) Happy developing! Goulstem 8144 — 7y
Ad

Answer this question