hi i am making a gta style game and im making the wanted level system (localscript if it shouldnt be let me know..) and i put it in StarterPlayerScripts but it doesnt change the visibility to true... what went wrong?
local WLevel = 1 -- testing to see if it works.. local character = game.Workspace.Player local player = game.Players:GetPlayerFromCharacter(character) local lvl1 = game.StarterGui.wantedlevel.lv1 local lvl2 = game.StarterGui.wantedlevel.lv2 local lvl3 = game.StarterGui.wantedlevel.lv3 local lvl4 = game.StarterGui.wantedlevel.lv4 local lvl5 = game.StarterGui.wantedlevel.lv5 if WLevel == 1 then Instance.new("Cop", workspace) and lvl1.visible = true and workspace.Cop.Torso.Position = Vector3.new(player.Position) else lvl1.visible = false end
edit forgot to mention its for a HUD
You dont use 'And' like that. Try this:
local WLevel = 1 -- testing to see if it works.. local character = game.Workspace.Player local player = game.Players:GetPlayerFromCharacter(character) local lvl1 = game.StarterGui.wantedlevel.lv1 local lvl2 = game.StarterGui.wantedlevel.lv2 local lvl3 = game.StarterGui.wantedlevel.lv3 local lvl4 = game.StarterGui.wantedlevel.lv4 local lvl5 = game.StarterGui.wantedlevel.lv5 if WLevel == 1 then Instance.new("Cop", workspace) lvl1.Visible = true workspace.Cop.Torso.Position = Vector3.new(player.Position) else lvl1.Visible = false end
wait(0.1) local WLevel = 1 -- testing to see if it works.. local character = game.Players.LocalPlayer.Character local player = game.Players:GetPlayerFromCharacter(character) local lvl1 = game.StarterGui.wantedlevel.lv1 local lvl2 = game.StarterGui.wantedlevel.lv2 local lvl3 = game.StarterGui.wantedlevel.lv3 local lvl4 = game.StarterGui.wantedlevel.lv4 local lvl5 = game.StarterGui.wantedlevel.lv5 if WLevel == 1 then Instance.new("Cop", workspace) lvl1.visible = true workspace.Cop.Torso.Position = Vector3.new(player.Position) else lvl1.visible = false end
This should work...