Not to bash on Instawin, but he isn't really answering what is wrong with your code and is giving you an entirely different solution to the problem.
So let's break this down line by line:
script.Parent.ClickDetector.MouseClick:connect(function(p)
This connects the MouseClick event to a un-named function with the parameter p
The parameter p "holds" the player that clicked it, not the character, but their player.
local pplayer = game.Players:GetPlayerFromCharacter(p)
This variable you have defined is attempting to the the Player from a character object.
The passed parameter to the GetPlayerFromCharacter() function requires a character object, but as we have looked at above, p is actually a player object. Thus, this line is not needed.
gui.Parent = game.Players.LocalPlayer.PlayerGui
LocalPlayer is a reserved variable that points to the Local Player.
What that means is: LocalPlayer points to the player that is running the script on their client.
However, your script is a child (found in) of the Workspace, meaning it is a server-side script, not a client-side script.
Client-side scripts run within a Player object itself (like its PlayerGui).
Client-side scripts are also LocalScript objects, not regular scripts.
In conclusion, the error here is that you are trying to access a client-side variable from a server-side script.
So, to fix up the script you gave:
script.Parent.ClickDetector.MouseClick:connect(function(p)
local gui = game.ReplicatedStorage.ATMGUI:Clone()
gui.Parent = p.PlayerGui
gui.Frame.Visible = true
gui.Frame:TweenPosition(UDim2.new(0.5, -150,.5, -75), "Out", "Quad", .5)
end)
Further resources you can look at:
ClickDetector.MouseClick
getPlayerFromCharacter
LocalPlayer
LocalScript
Client vs Server