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

How can i Call a Mouseclick?

How can i call a Clickdetector so the Player did not clicked it but the Clickdetector think it was Clicked?

2 answers

No, you can't truly simulate a mouse click. The best you can do is call the function associated with the ClickDetector.

i.e:

function clicked(player)
	print(("%s clicked this"):format(tostring(player)))
end

ClickDetector.MouseClick:Connect(clicked) -- When a player clicks on the clickdetector

clicked() -- The closest you can get to simulating a button press at the moment

In the example, the function clicked() is associated with the ClickDetector, so calling the function clicked() could 'simulate' a button press, although it will not send a keypress event.

Greetings, I hope this function answers your question.

Put this script in your ClickDetector in workspace.

script.Parent.MouseClick:Connect(function()
      --Whatever goes here will be fired when clicked!
end)

What this function does is give information to the ClickDetector, and fires the code inside of the function.

Making a part Transparent on click:

Make a part and anchor it. Inside the part add a ClickDetector and a script inside.

local part = yourpartlocation

script.Parent.MouseClick:Connect(function()
      part.Transparency = 1
end)

I hope this helps! And remember that this isn't a request site, so try this out yourself.

1 comment

0

I want to Simulate a Mouseclick i know hot a Clickdetector works

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