local statsoeffner = game.StarterGui.ScreenGui.statsoeffner
local diestats = game.StarterGui.ScreenGui.diestats
local script = script.Parent
local function statsgeoeffnet ()
print ("stats are visibile!")
end
statsoeffner.MouseButton1Click:Connect(statsgeoeffnet)
please explain detailed what i did wrong. i am new to coding.

2 comments
can you put this into a code block format?
You should do define the player (local player = game.Players.LocalPlayer) then do (plr.PlayerGui.ScreenGui.statsoeffner) to define the screengui (but i dont think thats the issue