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

I am trying to change transperency when clicking a click detector. Why isn't it working?

Hey guys. I am scripting a click detector, and when it get's clicked, a part changes transperency. When I was scripting it, it did not work. Here's the Local Script. Here's the Server Script. I cannot find the bug. Not error messages came in the output. What is the problem here?

1 comment

0

Why don't you just use a server script with no remote event? Since you can just put script under the part with the clickdetector.

2 answers

You really only need a server script. Also, local scripts don't work inside parts.

You basically have all you need, so here's a fixed version:

--Server script inside the part
script.Parent.ClickDetector.MouseClick:Connect(function()
	script.Parent.Transparency = 1
end)

First off, you should be putting the ClickDetector inside of the part you want to change the transparency of. Also, you do not need to use a RemoteEvent, or even a LocalScript.

You also don't need to use pastebin to show off your code. There are code bars that do that for you.

Here's the fixed script:

local transparency = 0.5

script.Parent.ClickDetector.MouseClick:Connect(function()
if script.Parent.Transparency ~= transparency then
script.Parent.Transparency = transparency

1 comment

0

I don't know how to; and when I've tried, people are saying it's not in the line. I don't know why it happend.

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