ModuleScript Question

Open and end with three backticks to post a code block

hello, 

this is a code block

image

lemme try rq

code

max charrr

this is the script that detects when the player dies. (Legacy script in SSS)

-- finality mode roll functions.

--variables.
print("functional.")
local remote1 = game:GetService("ReplicatedStorage").RemoteEventF:WaitForChild("ReplicateS1")
local remote2 = game:GetService("ReplicatedStorage").RemoteEventF:WaitForChild("ReplicateS2")

local Players = game:GetService("Players")

--this code basicly, when a player dies, there is a chance they will be revived and recive a power-up.
--one of which is rarer and stronger than the other (State 2)

Players.PlayerAdded:Connect(function(player)
	--function is present to define who each player is.
	player.CharacterAdded:Connect(function(character)
		--function is present to define if the player's character died.
		character:WaitForChild("Humanoid").Died:Connect(function(died)
		print("Humanoid has Died.")
		local Var = math.random(1,2)
		
		--rolling to see if finality mode will activate.
		if Var == 1 then
			print("Finality.")
			local Svar = math.random(1,2)
				if Svar ~= 1 then
					remote1:FireClient(player)
					require(game:GetService("StarterPlayer").StarterCharacterScripts["Finality Modes."].Spear["1stStateSS"])
				end
				
				if Svar == 1 then
					remote2:FireClient(player)
					require(game:GetService("StarterPlayer").StarterCharacterScripts["Finality Modes."].Spear["2ndStateSS"])
				end
			end	
			-- the following is if finality mode has not been activated.
			if Var ~= 1 then
				print("Finality mode has not been activated.")
			return end
		end)
	end)
end)

the following is the 1st state module script it is calling. this is the only module script that has any code in it rn (For the modes)

local module = {}

local function Trigger(Player)
	local Character = Player.Character
	print(Character.Name)
	--this is similar to the original code.
	--it always says index nil with player.character, im trying to get it so that it who the player is.
	--however, it is nessesary for it to be called from a legarcy script... i need to use LoadCharacter()
end


return module
remote1:FireClient(player)

I think that this is your issue – you’re firing a remote to the client without any additional parameters. Note that the first parameter of FireClient on any RemoteEvent will always be the desired client you are firing to.

require(game:GetService("StarterPlayer").StarterCharacterScripts["Finality Modes."].Spear["1stStateSS"])

I’m also unsure as to why you are requiring a ModuleScript from StarterCharacterScripts on the server. You’re also not referencing any value that it returns (after the parenthesis) which makes it even more confusing.

all the code will be run on the module script. also, you can forget about the remote events. i forget to delete that. should i forget modulescripts and use remote events instead? its rare to get a mode in game btw.

hello? (max charrrrrrrrrrrrrrrrrrrrr)