• Error when using ScreenFade on GMOD
    2 replies, posted
Help me please, im stalled and cant figure it out lol Lua [lua] function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end local teleportPos = self.Owner:GetEyeTrace().HitPos if(self.Owner:GetEyeTrace().HitWorld)then local plyPos = self.Owner:GetPos() if(teleportPos:Distance(plyPos)<1200)then for i,v in ipairs(player.GetAll())do if(v:GetPos():Distance(teleportPos)>100 )then else return false end end if CLIENT then self.Owner:ScreenFade( SCREENFADE.OUT, color_black, 0.3,0.3 ) timer.Create( "UniqueName", 0.3, 1, function() self.Owner:ScreenFade( SCREENFADE.IN, color_black, 0.3,0.3 ) end self.Owner:SetPos( teleportPos ) end ) self:EmitSound ("teleport.wav",100,100 ) end end end [/lua] Console [code] [ERROR] addons/slendermanswep/lua/weapons/slenderman/shared.lua:51: attempt to call method 'ScreenFade' (a nil value) 1. unknown - addons/slendermanswep/lua/weapons/slenderman/shared.lua:51 mod_studio: MOVETYPE_FOLLOW with no model. mod_studio: MOVETYPE_FOLLOW with no model. [DamienTehDemon|3|STEAM_0:0:59291866] Lua Error: [ERROR] addons/slendermanswep/lua/weapons/slenderman/shared.lua:51: attempt to call method 'ScreenFade' (a nil value) 1. unknown - addons/slendermanswep/lua/weapons/slenderman/shared.lua:51 [/code]
Try posting in this section instead: [url=http://facepunch.com/forumdisplay.php?f=65]Garry's mod Developer Discussion[/url] Or ask a mod to move this thread there.
[url]http://facepunch.com/showthread.php?t=1062304[/url] I dont know jack about LUA and I don't know if nil is anything like null but null means "no value". note that this doesn't mean 0, but rather that there is no value at all. In this case it means that either your function returns nothing, or that the function doesn't exist within the scope of how you're using it. Check to make sure that the function has been properly declared, that you're spelling it right, or that you're allowed to use it in the context of how you're using it. edit: in the future, take your error log, copy the first line or so and paste it into google to see if other people have had your problem. That's why the error log exists in this case it's: [code]attempt to call method 'ScreenFade' (a nil value)[/code]
Sorry, you need to Log In to post a reply to this thread.