Problem with gasa4 script

Hello world!

I would like to know what is wrong with this script? I keep getting the following error.

For the fresh burger I get error about "Player is not a valid member of players “players”


For the rotten burger, aka the one with the code i showed you it says, “Visible is not a valid member of screengui or something”

Heres both of them scripts in order

Rotten Burger:

local player = game:GetService("Players")

workspace.MeshPart2469.ProximityPrompt.Triggered:Connect(function(plr)
	--added this after i did the game.startergui.screen.text.endingrottenburger
	game.StarterGui.ScreenGui.TextLabel.Visible = true
	game.StarterGui.ScreenGui.Visible = true
	wait(2)
	game.StarterGui.ScreenGui.TextLabel.Text = "Ending 1 Rotten Burger"
	wait(2)
	game.StarterGui.ScreenGui.TextLabel.Text = "Aka burger king foot lettuce ending"
	wait(2)
	game.Players.Player:Kick("You gotta rejoin to get more endings!")
	wait(1)
	print("Somebody got an ending!")
end)

“Fresh” Burger
Code:


workspace.MeshPart.ProximityPrompt.Triggered:Connect(function(plr)
	--added this after i did the game.startergui.screen.text.endingrottenburger
	game.StarterGui.ScreenGui.TextLabel.Visible = true
	game.StarterGui.ScreenGui.TextLabel.Text = "Ending 2 Quote fresh burger"
	game.StarterGui.ScreenGui.TextLabel.Text = "This burger is fresh, and has only been left out for 4 days but hey!"
	wait(2)
	game.Players.Player:Kick("You gotta rejoin to get more endings!")
	wait(1)
	print("Somebody got an ending!")
end)
type or paste code here

Now, I’m making an gasa4 [Get an snack at 4:am] remake, with an twist, it has multiplayer and possibly interesting endings.

Here is the full-line up of objects in the area


MeshPart is the fresh burger
meshpart2469 is the rotten burger

also the tap in the kitchen turned off just as i sented the post, weird right [dont flag this]

plr:Kick("Message")

, not

game.Players.Player:Kick("Message")

because its obvious in the error message: “Player” isn’t a child of the Players Service.

1 Like

What about the visible problem?

also you are indexing StarterGui instead of PlayerGui

plr.PlayerGui.ScreenGui.TextLabel.Text = ""

“Visible” isn’t a valid property of ScreenGui instance. Instead use .Enabled like so:

game.StarterGui.ScreenGui.Enabled = true

Another problem,


“Kick” Is not an valid member of players “Players” and I just solved the visible thing myself.

It says your doing Players:Kick()

https://developer.roblox.com/en-us/api-reference/function/Player/Kick

Its Player:Kick()

Players Is the Service

nope,
image
its something do with Kick:() edit:
image

Actually yes…

also as i told u before the game.StaterGui will not change the UI for the player that is the Service that spawns new GUI’s into players when you edit it players wont see until they are given new gui’s ( Meaning they wont see the changes you make unless they reset)

1 Like

What if i make it local, so its local only so only 1 player will see it, and they cant reset [once i add that feature]

Here. I do not prefer to solve by typing the entire script but I have to so you will understand.

local Players = game:GetService("Players")

workspace.MeshPart2469.ProximityPrompt.Triggered:Connect(function(Player)
	Player.PlayerGui.ScreenGui.TextLabel.Enabled = true
	wait(2)
	Player.PlayerGui.ScreenGui.TextLabel.Text = "Ending 1 Rotten Burger"
	wait(2)
	Player.PlayerGui.ScreenGui.TextLabel.Text = "Aka burger king foot lettuce ending"
	wait(2)
	Player:Kick("You gotta rejoin to get more endings!")
	wait(1)
	print("Somebody got an ending!")
end)