Workspace.trollendprompt.ClickDetector.Script:5: attempt to index nil with 'PlayerGui

Hello guys when i was developing my game a error ocurred, What can i do for fix it, Can anyone help?
Ekran görüntüsü 2024-04-02 205741

ServerScripts can’t access the LocalPlayer, but ClickDetectors do return the player as a variable so just do:


also remove line 1 entirely

1 Like

-You cannot use local scripts in workspace.
-You can get the clicked player with mouseclick event.
-Checking without if PlayerGui existing.

     if Plr and Plr:FindFirstChild("PlayerGui") then
        Plr.PlayerGui.TrollEnding.Enabled = true
        workspace["Can You Really Call This A Hotel"]:Stop()
1 Like

Thank you dude, you resolved my issue.

1 Like

Have you also readed the yoshicoolTV’s reply,you shouldnt copy and paste your updated code and mark as solution.

Yeah i read hes also right but i tried the thing he said but it didnt worked i tried the text that you send now it worked

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.