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

Click detector not working???


script.Parent.MouseClick:connect(function() 
print"click" 
end)

This is literally just a script in a block and it doesn't print, my game is FE but i don't know if that's the problem. Please help.

8 comments

0

Is there a click detector inside the part?

0

yeah

0

Can you post the entire script?

0

that is the entire script

0

Is the entire function just to print "click" ?

0

pretty much

0

My answer should fix it since your game has fe on.

2 answers

Insert a Local script into the StarterGui

Inside local script :

local part = game.Workspace.Part

local cd =part.ClickDetector

Insert a Remote event in replicated storage name it ClickEvent

local ce=game:GetService ('ReplicatedStorage'):WaitForChild ('ClickEvent')

cd.MouseClick:connect(function()
  ce:FireServer()
end)

Inside the script in the part put this:

local ce = game:GetService('ReplicatedStorage'):WaitForChild('ClickEvent')

ce.OnServerEvent:connect(function()

print('clicked')

end)

3 comments

0

jt is... inside the part dude

0

Where is the script located?

0

Edited my answer hope it works now.

function OnClicked()
--put whatever the function does here
print("click")
end

script.Parent.ClickDetector.MouseClick:connect(OnClicked)

Hope this helps.

Note: Put wherever the part is where "script.Parent" is. I'm assuming the script is in the part.

3 comments

0

still doesnt work D:

0

Do you have filtering enabled on?

0

Yeah

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