GMod Derma Help

Hey guys! I’ve been having a problem with the SetImage command using Derma. I’m trying to add a background image for a rules text box in a gamemode, but it doesn’t show up. I have put the .vtf I’m trying to use in content/materials/VGUI/mvgrp. Every time I try and use it I get this error.



[ERROR] gamemodes/mvgrp/gamemode/cl_init.lua:20: attempt to index global 'BackgroundImage' (a nil value)
  1. unknown - gamemodes/mvgrp/gamemode/cl_init.lua:20
   2. unknown - lua/includes/modules/concommand.lua:69


Here’s my code…


include( 'shared.lua' )


//F1 Menu

function RulesMenu()

	local ply = LocalPlayer()
	
	local RulesMenu = vgui.Create("DFrame")
	RulesMenu:SetSize(900, 540)
	RulesMenu:Center()
	RulesMenu:SetTitle("MVGRP Rules")
	RulesMenu:SetVisible(true)
	RulesMenu:SetDraggable(false)
	RulesMenu:ShowCloseButton(true)
	RulesMenu:MakePopup()
	
	local BackGroundImage = vgui.Create("DImage", RulesMenu)
	BackgroundImage:SetImage("VGUI/mvgrp/menu.vtf")
	BackGroundImage:SetPos(0, 25)
	BackGroundImage:SetSize(900, 537)

	local RuleList = vgui.Create("DLabel", RulesMenu)
	RuleList:Center()
	RuleList:SetText("Rules n' Crap")
	RuleList:SetTextColor(Color(255, 255, 255, 255))
	end
concommand.Add("open_menu", RulesMenu)

Any help would be great! :slight_smile:

[editline]18th December 2013[/editline]

Okay I’m really stupid, the g in BackGroundImage was lower case, but the image is still a missing texture. Any ideas??

[editline]18th December 2013[/editline]

Fixed: The texture was only in my gamemodes folder not the actual GMod one :stuck_out_tongue: