Script done step-by-step according to documentation, yet refuses to react

So i’m stuck once again, because even though i’ve followed pretty much all steps that matter for this one script, it still returns nothing on the output, the script itself for reference:

local button = script.Parent.ClickDetector
local function onClicked(player)
	print("Clicked")
end
button.MouseClick:Connect(onClicked)

here’s the resource i used for correcting any mistakes:

And yet, upon clicking it, again, no reaction whatsoever, could it perhaps be because the resource itself is simply a bit dated, or could there be any other reason (for yet another reference, i am running this on a LocalScript)

1 Like

LocalScripts do not run in Workspace. You need to use a Script

1 Like

in that case, i presume only way to make things happen on local level is to use RemoteEvents

1 Like

You can detect ClickDetectors on the server though.

1 Like

No, actually. Scripts have a “RunContext” property which allow you to set their execution context to the client. This would effectively make them LocalScripts which can execute a in non-native environment. I don’t jive with using that property as it has caveats, and I prefer not to go against environmental designations. You can alternatively use a LocalScript in a designated environment and reference the ClickDetector from Workspace. You will still be able to detect interactions with the ClickDetector, just not from other clients

2 Likes

exactly what i needed, thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.