hi scripters, i'll go straight to the point. I'm making a boss fight game. the main script is basically. "teleport players to fightarea, brings random boss to game, after boss is killed, teleport players back to lobby" i get this by putting 2 bool values and a numbervalue, now everything works fine this is where i get the error

while true do
	if game.Players:GetPlayers()~=nil and area.Value==1 then
		StartGame("DUDE")
	elseif area.Value==2 and check.Value==false and ingame.Value==false then
		Moveplayers(game.Workspace.Lobby.Position)
		print("game ended")
		area=1
	elseif check.Value==true and ingame.Value==true and area.Value==3 then
		print("already ingame")
		wait(.5)
	end
	wait(.5)
end

the value "area" is a numbervalue i created inside the same script.

local area=Instance.new("NumberValue")
area.Parent=game.Workspace
area.Value=1
area.Name=("area")

as you can see whenever area.Value=1 it means the game starts. after that area.value=3. whenever i kill the boss area.Value=2 the error i get in the output after boss is killed is this attemp to index local"area"(a number value) at this line

if game.Players:GetPlayers()~=nil and area.Value==1 then

3 comments

0

Line 7 you set area = 1 resulting in this error.

0

line 7 u can just return area

0

Oooo i see it thank you awesome people i already had a headache!