The Error I get Is:

Workspace.GuiFixer:5: attempt to index local 'Player' (a nil value)

Why is this happening, and how do I fix it?

The coding for 'GuiFixer' is:

while true do
	wait(5)
	if game.ServerStorage.MenuGUI ~= nil then
		local Player = game.Players.LocalPlayer
		if game.Players:FindFirstChild(Player.Name).PlayerGui.MenuGUI == nil then
			game.ServerStorage.MenuGUI:Clone().Parent = game.Players:FindFirstChild(Player.Name).PlayerGui
		end	
		
	elseif game.ServerStorage.MenuGUI == nil then
		
		return
		
	end	
end

4 comments

0

Is this a local script or a server script?

0

It's a server script.

1

Then naturally, it wouldn't work. You can't index LocalPlayer from Server Scripts, which is why it doesn't work. Change it to a LocalScript and it should work.

0

Also, this means you cannot access ServerStorage, because it is for server only.