Soo i was watching this youtube tutorial for making teams and adding weps.
https://www.youtube.com/watch?v=msjJiDxS1uc&list=PLLAN7OC4G99Sx65F38iYoqv2J1OoaiJse&index=8
But for some reason when i try to add weapons it just doesnt work when i load gmod. Idunno what is wrong.
local ply = FindMetaTable("Player")
local teams = {}
teams[0] = {
name = "Red",
color = Vector ( 1.0, 0, 0 ),
weapons = { "weapon_357", "weapon_frag" } }
teams[1] = {
name = "Blue",
color = Vector ( 0, 0, 1.0 ),
weapons = { "weapon_crowbar", "weapon_crossbow", "weapon_shotgun" } }
function ply:SetupTeam( n )
if ( not teams[n]) then return end
self:SetTeam( n )
self:SetPlayerColor( teams[n].color )
self:SetHealth( 150 )
self:SetMaxHealth( 200 )
self:SetWalkSpeed( 100 )
self:SetRunSpeed( 1000 )
self:SetModel( "models/player/Group03m/Male_0" .. math.random(1,9) .. ".mdl" )
self:GiveWeapons( n )
end
function ply:GiveWeapons( n )
for k, weapon in pairs( teams[n].weapons )
self:Give( weapon )
end
end
This is my teamsetup.lua file. Its the same exact one shown in his video yet for me it still doesnt work!
Help is appreciated
Just followed this tutorial not that long ago, works fine. You did something wrong. Any Lua errors?
no nothing no script errors or anything
Did you follow his tutorials before this one or just this one?
all of em
you forgot "do" after
for k, weapon in pairs( teams[n].weapons )
ahh cheers guess it slipped under the rug
yeah just gotta pay attention to details. Go through it line by line. You can also use: https://www.diffchecker.com/ to help you
Ahh never knew about that welp thanks once again
Sorry, you need to Log In to post a reply to this thread.