Module Script Value Won't Work In Local Script

The module script seems to suggest that it updates after the local scripts runs, but I can’t be 100% sure.

maybe you should add a wait(3) infront of all of the code just to make sure?
just a temporary replacement, again.

eg:

--New LUA Voice Over script for COD Roblox MP game by @Pic3yune.

local GetLogic = require(game.ReplicatedStorage:WaitForChild("new_team_logic"))

local Team1 = GetLogic.Team1
local Team2 = GetLogic.Team2

local Head = game.Players.LocalPlayer.Character:WaitForChild("Head")

local Lines = nil

wait(3) --temp again

if true then --temporary replacement, just for testing my suspicions
	if Team1 == 1 then
		Lines = game.ReplicatedStorage.vox_players.americans:GetChildren()
	elseif Team1 == 2 then
		Lines = game.ReplicatedStorage.vox_players.british:GetChildren()
	elseif Team1 == 3 then
		Lines = game.ReplicatedStorage.vox_players.canadian:GetChildren()
		local Voiceline = Lines[math.random(1, #Lines)]:Clone()
		Voiceline.Parent = Head
		print("VOX Success!")
		if _G.Side == 1 then
			if Team2 == 1 then
				Lines = game.ReplicatedStorage.vox_players.aipc:GetChildren()
				if Team2 == 2 then
					Lines = game.ReplicatedStorage.vox_players.chinese:GetChildren()
					if Team2 == 3 then
						Lines = game.ReplicatedStorage.vox_players.africans:GetChildren()
						local Voiceline = Lines[math.random(1, #Lines)]:Clone()
						Voiceline.Parent = Head
						print("VOX Success!")
					end
				end
			end
		end
	end
end

I added a print statement under the if true statement

1 Like

im gonna send a quick script that you should quickly replace with, and send me the result. I’ll just add a lot of prints to debug.

--New LUA Voice Over script for COD Roblox MP game by @Pic3yune.

local GetLogic = require(game.ReplicatedStorage:WaitForChild("new_team_logic"))

local Team1 = GetLogic.Team1
local Team2 = GetLogic.Team2

local Head = game.Players.LocalPlayer.Character:WaitForChild("Head")

local Lines = nil

wait(3) --temp again

if true then --temporary replacement, just for testing my suspicions
    print(Team1)
	if Team1 == 1 then
        print("resA")
		Lines = game.ReplicatedStorage.vox_players.americans:GetChildren()
	elseif Team1 == 2 then
        print("resB")
		Lines = game.ReplicatedStorage.vox_players.british:GetChildren()
	elseif Team1 == 3 then
        print("resC")
		Lines = game.ReplicatedStorage.vox_players.canadian:GetChildren()
		local Voiceline = Lines[math.random(1, #Lines)]:Clone()
		Voiceline.Parent = Head
		print("VOX Success!")
		if _G.Side == 1 then
			if Team2 == 1 then
				Lines = game.ReplicatedStorage.vox_players.aipc:GetChildren()
				if Team2 == 2 then
					Lines = game.ReplicatedStorage.vox_players.chinese:GetChildren()
					if Team2 == 3 then
						Lines = game.ReplicatedStorage.vox_players.africans:GetChildren()
						local Voiceline = Lines[math.random(1, #Lines)]:Clone()
						Voiceline.Parent = Head
						print("VOX Success!")
					end
				end
			end
		end
    else
        print("team mismatch")
	end
end

i simply added prints for every occasion.

Wait I figured it out, I literally just needed to add this under every if/then statement

Lines = game.ReplicatedStorage.vox_players.americans:GetChildren()
		local Voiceline = Lines[math.random(1, #Lines)]:Clone()
		Voiceline.Parent = Head

ohhh, so it WAS working!

i was thinking that you’d use that variable later on in the script or something.

Well, glad you atleast figured it out!

1 Like

I thank you for your help! Please take care!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.