I am currently working on an FPS framework (mainly milsim) I made a team script to that players on a certain team, get a certain load-out/rifle. Im having problems with this one part and was wondering what is causing it and if there is a way to fix it. Thanks!
local gun
--LOAD THE GUN MODEL FOR TEAM1
if player.Team == game.Teams.Team1 then
if weaponType == 1 then
gun = self.primary2
else
if player.Team == game.Teams.Team2 then
if weaponType == 1 then
gun = self.primary1
elseif
weaponType == 2 then
gun = self.secondary
end
end
end
end
--CLONE THE GUN MODEL AND PUT IT IN THE WORKSPACE
self.current = gun:clone()
self.current.Parent = game.Workspace

4 comments
is it meant to go into the workspace
Team1 works fine, Team2 has an error
Team1 works fine, Team2 has an error Players.quackroblox10.PlayerScripts.Framework:1291: attempt to index local 'gun' (a nil value)
nvm got it working