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

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

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.

2 comments

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.

0

That's just a general concept, but I am sure someone can go into more detail for you.

1 answer

✓ Accepted answer

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.

3 comments

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)

0

Update note, thanks so much. This opens so many new doors for me, i can do so much more!

0

No problem :) Happy developing!

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