Hello! So Im trying to make a Elimination game, Ok neverminded by now you get the point if you saw my last post.... Lastly x2 considering my script STILL DOESNT WANT TO WORK WITH ME >:( Basically, Im trying to make it so that a Text will show, It will explain to the players how to play the game, when Its done the baseplate will start to shrink, when theirs one more player in the game then, the text will pop back up explaining that they won and then their supposed to get a badge ( when I have the robux to make it ) and then they will get kicked from the game! ( or teleported to a sequel if I do end up having people liking the game! )
Here is the Script
-- 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 = game:GetService("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)
Here is the Error
11:34:49.045 ServerScriptService.MainScript:36: attempt to index nil with 'TutorialText' - Server - MainScript:36
11:34:49.045 Stack Begin - Studio
11:34:49.045 Script 'ServerScriptService.MainScript', Line 36 - function StopTheGameAWinnerHasBeenChosen - Studio - MainScript:36
11:34:49.045 Script 'ServerScriptService.MainScript', Line 50 - Studio - MainScript:50
11:34:49.046 Stack End - Studio
You’ll need to have a ScreenGui in StarterGui with a TextLabel parented to it. It looks like you’re currently trying to change the text property of a direct child of StarterGui.
Edit:
Here’s a thread where someone did something similar:
12:01:59.874 LocalPlayer is not a valid member of DataModel "Server" - Server - MainScript:7
12:01:59.874 Stack Begin - Studio
12:01:59.874 Script 'ServerScriptService.MainScript', Line 7 - Studio - MainScript:7
12:01:59.874 Stack End - Studio
12:02:16.404 ▶ Unable to load plugin icon. (x2) - Studio
You won’t ever be able to get this to work. If you try to index LocalPlayer, you’ll be obligated to use a LocalScript, which isn’t able to access ServerScriptService or ServerStorage.
And also, you better remake all of of this, because the code is bad. You should learn more about scripting, until you think you’re ready. Try not to make a game so early.
@rtvr56565 , the issue is that you forgot to index the Players folder:
12:05:18.431 KickHandler is not a valid member of ServerScriptService "ServerScriptService" - Client - LocalScript:4
12:05:18.433 Stack Begin - Studio
12:05:18.433 Script 'Workspace.NubblyFry.LocalScript', Line 4 - Studio - LocalScript:4
12:05:18.434 Stack End - Studio
12:05:21.971 0.5, 0.5 - Server
12:05:22.208 0.5, 0.5 - Client
12:05:37.364 Script timeout: exhausted allowed execution time - Server - KickHandler:2
12:05:37.368 Stack Begin - Studio
12:05:37.368 Script 'ServerScriptService.KickHandler', Line 2 - Studio - KickHandler:2
12:05:37.369 Stack End - Studio
The whole script breaks just if Im trying to get the GUI to show.
Early? Idk why people keep saying that I should learn more scripting, as long as a script works for me then, Im fine with it, Everyone scripts differently after all