local plr = game:GetService("Players").LocalPlayer
debounce = false
script.Parent.MouseButton1Click:Connect(function()
if not debounce then
debounce = true
game.Workspace.Part.Value.Value = game.Workspace.Part.Value.Value - 25
wait(1)
debounce = false
end
if game.Workspace.Part.Value.Value == 0 then
game.Workspace.Part.Transparency = 1
plr.PlayerGui.ScreenGui.TextButton.Parent = game.Workspace.Part-- it wont find the local player
wait(5)
game.Workspace.Part.Transparency = 0
game.Workspace.Part.Value.Value = 100
print(script:GetFullName())
end
end)
COMMUNITY QUESTION
How can i make it access the local player?
1 answer
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.
2 comments
0
thanks
0
@Gameplayer365247v2 Please mark the answer as accepted/correct.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
I'm assuming this is a local script?
Also, you can instead clone the TextButton into the part and destroy the original TextButton.
try the "for i,v pairs" method, that's what I use
but i still need to access the local player, thats my issue