Error game.player:FindFirstChild(player.Name)

Hello, (the following is a module script), my problem is that line 8 should search for a local player but it does not and gives an error

local ForzarActivacion = {}

ForzarActivacion.Indicador = {"cargando",	"carga casí completa",	"finalizado"} 

local Lighting = game:GetService("Lighting")

ForzarActivacion.CargandoFuncionDeGraficos = function(Activacion, player)
	local player = game.Players:FindFirstChild(player.Name)
	local StringValueShadow = player.Graficos.Shadow
	if StringValueShadow.Value == "Bajo" then
		for _, item in ipairs(workspace:GetDescendants()) do
			if item:IsA("PointLight") then 
				Lighting.GlobalShadows = false
				Lighting.ShadowSoftness = 1
				item.Shadows = false
				item.Brightness = 0.35
				print("Sombras en bajo")
			end
		end
	elseif StringValueShadow.Value == "Medio" then 
		for _, item in ipairs(workspace:GetDescendants()) do
			if item:IsA("PointLight") then 
				Lighting.GlobalShadows = true
				Lighting.ShadowSoftness = 0.5
				item.Shadows = false
				item.Brightness = 0.35
				print("Sombras en medio")
			end
		end
	elseif StringValueShadow.Value == "Alto" then 
		for _, item in ipairs(workspace:GetDescendants()) do
			if item:IsA("PointLight") then 
				Lighting.GlobalShadows = true
				Lighting.ShadowSoftness = 0.1
				item.Shadows = true
				item.Brightness = 0.75
				print("Sombras en alto")
			end
		end
	end
end

return ForzarActivacion
1 Like

What is the error so we can assist you further.

Hello, what’s the error? Make sure to be detailed on your future posts.

line 8 is to search for a local player, which he does not do and gives an error. So I can’t do the rest of the function

We’re asking you for the error, also, you’re spanish, right?

Indeed, the error is that with the FindFirstChild the player must be searched but not searched

So the argument that you’re getting it’s a Instance, right?

I guess so, because I need to find the player with the ModuleScript to run it

Alright so, you made a Module, you must call the module from another script.

Using:

  • require(Location or ID).
  • And using the functions of it.

But anyways, check that the ‘Player’ argument it’s an Instance.

I do not mean a specific player, but the player who enters the game (it can be anyone)

Yes, but if you’d like to get the Player Instance, just use PlayerAdded:Connect(function() and then call the module myModule.CargandoFuncionDeGraficos().

1 Like