Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help/fix on this part of framework. What's causing it?

Asked by 7 years ago

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
0
is it meant to go into the workspace abnotaddable 920 — 7y
0
Team1 works fine, Team2 has an error The_MRAP 4 — 7y
0
Team1 works fine, Team2 has an error Players.quackroblox10.PlayerScripts.Framework:1291: attempt to index local 'gun' (a nil value) The_MRAP 4 — 7y
0
nvm got it working The_MRAP 4 — 7y

Answer this question