Now I’ve heard 1 million different things about how to use module script values in local scripts. But I’ve tired most of them to no avail sadly, I’ll post my script here in hopes that someone knows what’s going on since I’m at a full loss.
--Local Script
--New LUA Voice Over script for COD Roblox MP game by @Pic3yune.
local Logic = require(game.ReplicatedStorage.new_team_logic)
local Team1 = Logic.Team1
local Team2 = Logic.Team2
local Head = game.Players.LocalPlayer.Character:WaitForChild("Head")
local Lines = nil
if _G.Side == 0 then
if Team1 == 1 then
Lines = game.ReplicatedStorage.vox_players.americans:GetChildren()
if Team1 == 2 then
Lines = game.ReplicatedStorage.vox_players.british:GetChildren()
if 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
end
end
I’m afraid I don’t know what your talking about, I tried to the best of my ability only to get nothing.
--New team script for COD game by @Pic3yune.
local Teams = {}
Teams.Team1 = 1 --1 = USA, 2 = British, 3 = Canadians.
Teams.Team2 = 1 --1 = AI Player Characters, 2 = Chinese, 3 = Africans.
Teams.getTeams = function()
return Teams;
end
--New LUA Voice Over script for COD Roblox MP game by @Pic3yune.
local GetLogic = 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
if _G.Side == 0 then
if Team1 == 1 then
Lines = game.ReplicatedStorage.vox_players.americans:GetChildren()
if Team1 == 2 then
Lines = game.ReplicatedStorage.vox_players.british:GetChildren()
if 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
end
end
GetLogic.getTeams()
in the module script, did you put the line: return Teams?
this is a really common mistake, so it might be the problem.
Im kinda busy rn, so ill follow up later if i find anything else.
--New team script for COD game by @Pic3yune.
local Teams = {}
Teams.Team1 = 1 --1 = USA, 2 = British, 3 = Canadians.
Teams.Team2 = 1 --1 = AI Player Characters, 2 = Chinese, 3 = Africans.
Teams.getTeams = function()
return Teams;
end
Yeah, could you add the return Teams line at the bottom?
I know you have a function to retrieve it, but how will you run the function if you aren’t returning the function?
edit - in your main script you also need to make use of the require statement in the GetLogic variable. It should be: local GetLogic = require(game.ReplicatedStorage:WaitForChild("new_team_logic"))
Sorry that I edited into the last message so lazily, but I’ll explain it here.
You can go down two routes, one of which i recommend.
The first solution you could do is replace local GetLogic with local GetLogic = require(game.ReplicatedStorage:WaitForChild("new_team_logic")).getTeams() and remove the last line of the local script (which is GetLogic.getTeams())
The better solution is to replacelocal GetLogic with local GetLogic = require(game.ReplicatedStorage:WaitForChild("new_team_logic")), and just remove all references to the getTeams() function, as it is unnecessary.
edit - just realised this is your original script, maybe the :WaitForChild will do something to help? You should also doublecheck that the module scripts in the right location
--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
if _G.Side == 0 then
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
maybe try replacing _G.Side == 0 temporarily just to double check? maybe with just true?
You did say it stopped at if Team1 == 1 then… just want to quickly confirm my suspicions.
if _G.Side == true then
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 == nil 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
omg, im so sorry im still very unclear. I’ll just give you the script with the changes made to it.
--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
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