Why doesnt transparency go down?

Hi why ist my script working?? I made it in a local script cause i want it to only happen for that one player and not for all? is there anyway to fix this here is the script:

script.Parent.ClickDetector.MouseClick:Connect(function() script.Parent.Transparency = script.Parent.Transparency + 0.1 end)

LocalScript? Those don’t run as childs of the Workspace. Place it somewhere else.


Tip: instead of rewriting the same line like this:

Do:

script.Parent.Transparency += 0.1

If you want a local script to run inside an object in the workspace you have to do something different. LocalScripts work a little wonky based on where they are located

Create a Script, then set it’s RunContext property to Client. It should then run properly

Local scripts don’t work that way in Workspace.

Hi thanks guys but how do i make it so that when the player click the dectors only for him the block turns transparent? cause if it doesnt work in workspace then like what do i do?

Try using a remote function and fire it from a script to a local script.

Remote Functions pass information from scripts to local scripts, and from local scripts to scripts (depending on which way it’s being fired)

Try checking out this video:
https://www.google.com/search?client=opera-gx&q=How+to+use+remote+functions&sourceid=opera&ie=UTF-8&oe=UTF-8#fpstate=ive&vld=cid:ed27d025,vid:XPI3EYelWzY,st:0

Example

  • Player clicks the part
  • The script detects that clickdetector has been triggered and fires a remote event with the players name in it.
  • Local script receives that and if the player has the same name as the person who triggered the clickdetector it makes the part invisible.

Using same script, put it in startergui or starterplayerscripts.

local clickdetector = workspace.Part.ClickDetector -- path to ur clickdetector
clickdetector.MouseClick:Connect(function() 
    clickdetector.Parent.Transparency += 0.1
end)