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

Is it possible to create a click button without the need for a ClickDetector?

Basically what the title says. I'm making a form of hidden bunker, and I need a way to be able to either hide the ClickDetector's custom cursor, or be able to create the button without the need for the ClickDetector altogether. Is this possible?

1 answer

✓ Accepted answer

This isn't as hard as you think, but it is completly local.

You can acces the Mouse in a player (local Mouse = LocalPlayer:GetMouse())

Then use Mouse.Button1Down:Connect(function()

We can then check if Mouse.Target is the part you wanted to be the hidden click detector

F.i. if Mouse.Target == game.Workspace.HiddenClickDetector then

Make sure to check if the Target is not nil though! if Mouse.Target then

In the end this would give us:

local Mouse = game.Players.LocalPlayer:GetMouse()
local HiddenDetector = workspace.HiddenClickDetector

Mouse.Button1Down:Connect(function()
	if Mouse.Target then
		if Mouse.Target == HiddenDetector then
			--Do your stuff
		end
	end
end)

Any questions? Add a comment :D

Edit:

Mouse on wiki: http://wiki.roblox.com/index.php?title=API:Class/Mouse&redirect=yes

You could even add a Value inside the part (A boolean value or something) And check if that Instance is inside of the part, May there ever be a user named "HiddenClickDetector".

2 comments

0

Nope, this is brilliant. Thanks for the help.

0

No problem.

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