Only 1 person can get passed the menu

I’m currently having a problem in my game with my menu, if one person joins they can get passed the menu just fine, but if someone else joins they can’t get passed the menu no matter how long the wait or click the play button

Here is the script

local Button = script.Parent
local Blur = game.Lighting.Blur
game.Players.LocalPlayer.Character:WaitForChild(“Humanoid”).WalkSpeed = 0
local Icon = script.Parent.Parent.ImageLabel
local Credits = script.Parent.Parent.Credits
local Shop = game:GetService(‘Players’).LocalPlayer.PlayerGui.ShopGui
local Car = game:GetService(‘Players’).LocalPlayer.PlayerGui.CarGui
local Dance = game:GetService(‘Players’).LocalPlayer.PlayerGui.DanceGui
local Inv = game:GetService(‘Players’).LocalPlayer.PlayerGui.InventoryGui
local Age = game:GetService(‘Players’).LocalPlayer.PlayerGui.AgeSelector
local CashView = game:GetService(‘Players’).LocalPlayer.PlayerGui.CashDisplay
local Clock = game:GetService(‘Players’).LocalPlayer.PlayerGui.Clock

Button.MouseButton1Click:Connect(function()
Icon.Visible = false
game.Players.LocalPlayer.Character:WaitForChild(“Humanoid”).WalkSpeed = 16
Blur.Enabled = false
Button.Visible = false
Credits.Visible = false
Car.Enabled = true
Dance.Enabled = true
Inv.Enabled = true
Shop.Enabled = true
CashView.Enabled = true
Clock.Enabled = true
wait (1) Age.Enabled = true

end)

Your script shouldn’t interrupt other player’s menus since it is client-sided. So you must have some other script that breaks the menu?

No errors in the console at all, all the gui in the script is what is in gui and no errors from them.

Actually i checked the dev console on the opposite players screen and it’s line 12 that is causing the problems saying "Clock is is not a valid member of PlayerGui “Players.MoreKedobu.PlayerGui”

But on the first players screen you can get past the menu and no clock errors in the console

786437bfa84f9d865d69e6bc7c61584e

Try doing wait(3) at the first line. I think it is because the 2nd player is taking a little longer to load, so when you define the local it doesn’t exist yet.

I know there is a more clever way of just using wait() tho.

Use a local script instead of a server script

1 Like

try this Script
Make sure the script is localscript.

local Players = game:GetService("Players")
local Lighting = game:GetService("Lighting")

local localPlayer = Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local hum = character:WaitForChild("Humanoid")

local Button = script.Parent
local Blur = Lighting:FindFirstChild("Blur")
local Icon = script.Parent.Parent.ImageLabel
local Credits = script.Parent.Parent.Credits

local UIs = {
	"ShopGui",
	"CarGui",
	"DanceGui",
	"InventoryGui",
	"AgeSelector",
	"CashDisplay",
	"Clock"
}

hum.WalkSpeed = 0

Button.MouseButton1Click:Connect(function()
	hum.WalkSpeed = 16
	
	Button.Visible = false
	Blur.Enabled = false
	Icon.Visible = false
	Credits.Visible = false
	
	for i = 1, #UIs do
		local value = UIs[i]
		local AgeSelector

		if value == "AgeSelector" then
			AgeSelector = playerGui:FindFirstChild(value)
		else
			if playerGui:FindFirstChild(value) then
				playerGui[value].Enabled = true
			end
		end

		if AgeSelector then
			wait(1)
			AgeSelector.Enabled = true
		end
	end	

end)
3 Likes

Try intending your code using blocs.

like this

Make a Local Script. Since UI are client-sided you are making them server sided

It was a local script, not sure why it was not working but thank you anyways!

It was a local script but your script works so thank you!

1 Like

It was solved by @Rami_XD1, thank you anyway!

Added the text in the bottom right as thanks!

Made sure to include it in the new script, don’t worry!