• Attempt to use NULL entity
    2 replies, posted
The code that is causes this error: [lua] if (LocalPlayer():GetNWFloat('water') <= 105 and LocalPlayer():GetNWFloat('water') >= 99) then [/lua] and the networked float water exists here: [lua] function GM:PlayerInitialSpawn(ply) PrintMessage(HUD_PRINTTALK, "[GAMEMODE NAME]"..ply:GetName().." Joined the game!") ply:SetNWFloat('food', 0, ply:GetNWFloat('food')) ply:SetNWFloat('water', 0, ply:GetNWFloat('water')) ply:SetNWFloat('money', 250, ply:GetNWFloat('money')) end [/lua]
LocalPlayer() is probably NULL when you first join the server, assuming that first line is from a HUD, add [code]if ( !IsValid( LocalPlayer() ) ) then return end[/code] to the top of your HUD function(s).
[QUOTE=Robotboy655;48033680]LocalPlayer() is probably NULL when you first join the server, assuming that first line is from a HUD, add [code]if ( !IsValid( LocalPlayer() ) ) then return end[/code] to the top of your HUD function(s).[/QUOTE] Thankyou
Sorry, you need to Log In to post a reply to this thread.