So I'm fairly new to scripting and I'm working on something utilizing a click detector. I've read over some info on the developer thing from roblox where it says it'll work on both scripts and local scripts. Well, I wanted to adjust the camera with it but for some reason nothing happens. So I tried using something a bit simpler.
For example: script.Parent.ClickDetector.MouseClick:Connect(function() workspace.Baseplate.Transparency = 1 end) But nothing.
Even after running it through a remote event (script to local), passing the player who clicked, nothing happens. Is there something about the click detector that I'm missing? Does it just negate the use of remote events entirely or something?
A LocalScript will only run Lua code if it is a descendant of one of the following objects:
To make your script work, create a new LocalScript in one of the mentioned objects above. Now, we want to get the ClickDetector and use the MouseClick event to change the baseplate's transparency to 1. LocalScript's Code:
workspace.Part:WaitForChild("ClickDetector").MouseClick:Connect(function() -- Wait for the ClickDetector to load, then we connect the MouseClick event handler to an anonymous function workspace.Baseplate.Transparency = 1 end)
in ur example u need to wait for the clickdetector so do
script.Parent:WaitForChild("ClickDetector").MouseClick:Connect(function() workspace.Baseplate.Transparency = 1 end)