PlayerGui isn’t a service, it’s a child inside of a player. You would have to define player somehow and then replace it with local PlayerGui = player.PlayerGui
.
What everyone said with PlayerGui xd
You can use RemoteEvent
, GetAttributeChangedSignal
or do it from the server, here with the simplest thing with RemoteEvent
.
Organization
Script
-- Defining Variables
local TutorialText = game.StarterGui.ScreenGui.TutorialText
local BaseplateStrinkScript = workspace.Baseplate.Script
local kickHandlerScript = game.ServerScriptService.KickHandler
local playersInServer = #game.Players:GetPlayers()
-- First Line Of Code
BaseplateStrinkScript.Disabled = true
kickHandlerScript.Disabled = true
-- Game Startup
function Send(Property, Value)
game:GetService("ReplicatedStorage").RemoteEvent:FireAllClients(Property, Value)
end
local function StartTheGame()
kickHandlerScript.Disabled = false
wait(5)
Send("Visible", true)
wait(4)
Send("Text", "In this game, Players must use the cars and Knock eachother off the Baseplate!")
wait(7)
Send("Text", "The Baseplate Will Strink Slowly so make sure you dont fall!")
wait(7)
Send("Text", "The Last player Standing Wins!")
wait(5)
Send("Text", "Goodluck, Players!")
wait(5)
Send("Visible", false)
BaseplateStrinkScript.Disabled = false
end
-- Looking For The Winner
local function StopTheGameAWinnerHasBeenChosen()
BaseplateStrinkScript.Disabled = true
wait(5)
Send("Visible", true)
Send("Text", "Great Job Player!")
wait(4)
Send("Text", "Looks Like you have Won the game!")
wait(5)
Send("Text", "Your now one of the Best Fighters In Robloxia!")
wait(7)
Send("Text", "You were truley a Bloxer, you Deserve This Medal!")
wait(5)
Send("Text", "Congrats and, Goodbye!")
end
game:GetService("Players").PlayerRemoving:Connect(function()
if #game:GetService("Players"):GetPlayers() == 1 then
StopTheGameAWinnerHasBeenChosen()
end
end)
game:GetService("Players").PlayerRemoving:Connect(function()
if #game:GetService("Players"):GetPlayers() == math.random(2,20) then
StartTheGame()
end
end)
LocalScript
Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
Event.OnClientEvent:Connect(function(Property, Value)
script.Parent[Property] = Value
end)
Everyone can make mistakes or forget the obvious also say obvious things, the latter usually happens a lot.
What did Ggblocks20 do wrong? Also you said “To be programmer” which is not correct.
All i meant was that he didn’t know how to get the local player… I had written it down right before.
local plr = game:GetService("Players").LocalPlayer
local plrGui = plr.PlayerGui
18:46:08.708 ServerScriptService.MainScript:7: attempt to index nil with 'PlayerGui' - Server - MainScript:7
18:46:08.709 Stack Begin - Studio
18:46:08.709 Script 'ServerScriptService.MainScript', Line 7 - Studio - MainScript:7
18:46:08.709 Stack End - Studio
Where did you place the script?
ServerSS
You can’t call local player from server, so if anything, your the one who doesn’t know how to program.
Besides, I trust that the OP knows how to define the player, his issue was trying to call PlayerGui as a service, not defining the player.
To OP:
Try something like this:
Code
game.Players.PlayerAdded:Connect(function(player)
-- Defining Variables
local TutorialText = game.StarterGui.ScreenGui.TutorialText
local BaseplateStrinkScript = game.Workspace.Baseplate.Script
local kickHandlerScript = game.ServerScriptService.KickHandler
local playersInServer = #game.Players:GetPlayers()
local PlayerGui = player.PlayerGui
-- First Line Of Code
BaseplateStrinkScript.Disabled = true
kickHandlerScript.Disabled = true
-- Game Startup
local function StartTheGame()
kickHandlerScript.Disabled = false
wait(5)
PlayerGui.TutorialText.Visible = true
wait(4)
PlayerGui.TutorialText.Text = "In this game, Players must use the cars and Knock eachother off the Baseplate!"
wait(7)
PlayerGui.TutorialText.Text = "The Baseplate Will Strink Slowly so make sure you dont fall!"
wait(7)
PlayerGui.TutorialText.Text = "The Last player Standing Wins!"
wait(5)
PlayerGui.TutorialText.Text = "Goodluck, Players!"
wait(5)
PlayerGui.TutorialText.Visible = false
BaseplateStrinkScript.Disabled = false
end
-- Looking For The Winner
local function StopTheGameAWinnerHasBeenChosen()
BaseplateStrinkScript.Disabled = true
wait(5)
PlayerGui.TutorialText.Visible = true
PlayerGui.TutorialText.Text = "Great Job Player!"
wait(4)
PlayerGui.TutorialText.Text = "Looks Like you have Won the game!"
wait(5)
PlayerGui.TutorialText.Text = "Your now one of the Best Fighters In Robloxia!"
wait(7)
PlayerGui.TutorialText.Text = "You were truley a Bloxer, you Deserve This Medal!"
wait(5)
PlayerGui.TutorialText.Text = "Congrats and, Goodbye!"
end
game.Players.PlayerRemoving:Connect(function()
if #game.Players:GetPlayers() == 1 then
StopTheGameAWinnerHasBeenChosen()
end
end)
game.Players.PlayerRemoving:Connect(function()
if #game.Players:GetPlayers() == math.random(2,20) then -- Checks if the playerlist has 2 all of the way to 20 players.
StartTheGame()
end
end)
end)
I edited some of your code:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
playerGui = player:WaitForChild("PlayerGui")
end)
end)
– Defining Variables
local TutorialText = playerGui.ScreenGui.TutorialText
local BaseplateStrinkScript = game.Workspace.Baseplate.Script
local kickHandlerScript = game.ServerScriptService.KickHandler
local playersInServer = #game.Players:GetPlayers()
– First Line Of Code
BaseplateStrinkScript.Disabled = true
kickHandlerScript.Disabled = true
– Game Startup
local function StartTheGame()
kickHandlerScript.Disabled = false
wait(5)
PlayerGui.TutorialText.Visible = true
wait(4)
PlayerGui.TutorialText.Text = “In this game, Players must use the cars and Knock eachother off the Baseplate!”
wait(7)
PlayerGui.TutorialText.Text = “The Baseplate Will Strink Slowly so make sure you dont fall!”
wait(7)
PlayerGui.TutorialText.Text = “The Last player Standing Wins!”
wait(5)
PlayerGui.TutorialText.Text = “Goodluck, Players!”
wait(5)
PlayerGui.TutorialText.Visible = false
BaseplateStrinkScript.Disabled = false
end
– Looking For The Winner
local function StopTheGameAWinnerHasBeenChosen()
BaseplateStrinkScript.Disabled = true
wait(5)
PlayerGui.TutorialText.Visible = true
PlayerGui.TutorialText.Text = “Great Job Player!”
wait(4)
PlayerGui.TutorialText.Text = “Looks Like you have Won the game!”
wait(5)
PlayerGui.TutorialText.Text = “Your now one of the Best Fighters In Robloxia!”
wait(7)
PlayerGui.TutorialText.Text = “You were truley a Bloxer, you Deserve This Medal!”
wait(5)
PlayerGui.TutorialText.Text = “Congrats and, Goodbye!”
end
game.Players.PlayerRemoving:Connect(function()
if #game.Players:GetPlayers() == 1 then
StopTheGameAWinnerHasBeenChosen()
end
end)
game.Players.PlayerRemoving:Connect(function()
if #game.Players:GetPlayers() == math.random(2,20) then – Checks if the playerlist has 2 all of the way to 20 players.
StartTheGame()
end
end)
I was originally going to do a remote event but I changed ways up because the way I did I think is easier. Also, I am not sure what
is about because I thought TurtorialText was in a screen gui not player gui its self.
If there are any errors tell me
I think I might know your error. You cannot access playergui from a server script when filtering enabled is on. I think by default it is now on.
Actually Roblox FE is always on and you can never disable it because of exploiters.
That’s not true? I’ve done it in tons of games and projects, all FE does is prevent the client from having access to the server.