01 | local plr = game:GetService( "Players" ).LocalPlayer |
02 |
03 | debounce = false |
04 |
05 | script.Parent.MouseButton 1 Click:Connect( function () |
06 |
07 | if not debounce then |
08 |
09 | debounce = true |
10 |
11 | game.Workspace.Part.Value.Value = game.Workspace.Part.Value.Value - 25 |
12 |
13 | wait( 1 ) |
14 |
15 | debounce = false |
16 |
17 | end |
18 |
19 | if game.Workspace.Part.Value.Value = = 0 then |
20 |
21 | game.Workspace.Part.Transparency = 1 |
22 |
23 | plr.PlayerGui.ScreenGui.TextButton.Parent = game.Workspace.Part -- it wont find the local player |
24 |
25 | wait( 5 ) |
26 |
27 | game.Workspace.Part.Transparency = 0 |
28 |
29 | game.Workspace.Part.Value.Value = 100 |
30 |
31 | print (script:GetFullName()) |
32 |
33 | end |
34 |
35 | end ) |
You can't use the LocalPlayer in a (Server)Script, only LocalScripts.
And, looking at script.Parent.MouseButton1Click:Connect(function()
,
you seem to be using this in a GUI.
If that is true, you'll have to use a localscript as (server)scripts don't work in GUIs.
If the problem is FilteringEnabled being forced, you can use remotes.