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

Can I fire a ClickDetector MouseClick event in a localscript?

2 answers

✓ Accepted answer

You can make a seperate non anonymous-function for it, and call it whenever you need to,

For example:

Hierarchy: Part |--> ClickDetector |--> LocalScript

Script:

local function clickDetected()
	print("Hello")
end

script.Parent.MouseClick:Connect(clickDetected)

for i = 1,10 do
	clickDetected()
end

2 comments

0

I'm trying to call a ClickDetector click event from the studio commandline, not making another localscript inside the part. Sorry for not clarifying that. This method isn't working from the command line ^^ thanks for the input tho

0

not possible then. you can't activate events only the code inside the events like op did above

If it is in a gui, then put a local script in a textbutton saying : script.Parent.MouseButton1Click:Connect(function() print("clicked") end)

edit 1 : okay a part.

script.Parent.ClickDetector.MouseClick:Connect(function() print("clicked") end)

2 comments

0

It's in a brick

0

alright i added an edit for parts

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