GameplayPaused help. How would I do this?

Hello!
So recently I was making one of my games, and I wanted to make it so when a player joins, they have that GameplayPaused screen for aprox. 5 seconds.

local aPlayer = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(aPlayer)
	aPlayer.GameplayPaused = true
	wait(5)
	aPlayer.GameplayPaused = false
end)

Also, StreamingEnabled is enabled too!
However, when I use this script, it returns: “Unable to assign property GameplayPaused. Script write access is restricted
What is happening here? I clearly see that I can’t turn on the GameplayPaused feature on/off.

Is there even an way to enable the GameplayPaused GUI using scripts?

local Players = game:GetService(“Players”)
local aPlayer = Players.LocalPlayer

game.Players.PlayerAdded:Connect(function(aPlayer)
aPlayer.GameplayPaused = true
wait(5)
aPlayer.GameplayPaused = false
end)

1 Like

Thank you for helping, but it seems as the same error is happening.

The main response that I was wanting was not to finish up or modify on the script I gave, the question was:
" Is there even an way to enable the GameplayPaused GUI using scripts? (How would I be able to turn on the GameplayPaused property of a player.)"

Even when I try the code you gave me, it still gives out the error " Unable to assign property GameplayPaused. Script write access is restricted"

Well, I searched a bit up. You can only enable it within a normal script. Not with local scripts

Nevermind, it works somehow. Sometimes it doesn’t work though