Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does my script not work at the elseif part?


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
	local leaderstats = player:WaitForChild("leaderstats")
	local CheckValue = leaderstats:WaitForChild(script:WaitForChild("leaderstats").Value)
	
if CheckValue.Value >= 0 and CheckValue.Value < 500 then
		
			if char:WaitForChild("Head"):FindFirstChild("Rank") then
				wait(3)	
				char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()	
			end	
			
			 if not char:WaitForChild("Head"):FindFirstChild("Rank") then
				local a = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("NOOB"):Clone()
				a.Name = "Rank"
				a.Parent = char:WaitForChild("Head")
			end
			
	elseif CheckValue.Value >= 500 and CheckValue.Value < 1000 then
		
			if char:WaitForChild("Head"):FindFirstChild("Rank") then
				wait(3)	
				char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()	
			end	
						 
			if not char:WaitForChild("Head"):FindFirstChild("Rank") then				
				local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("BETTER"):Clone()
				b.Name = "Rank"
				b.Parent = char:WaitForChild("Head")
			end

end
	
CheckValue.Changed:Connect(function()
if CheckValue.Value >= 0 and CheckValue.Value < 50 then
						
						if char:WaitForChild("Head"):FindFirstChild("Rank") then
							wait(3)	
							char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()	
						end	
						
						if not char:WaitForChild("Head"):FindFirstChild("Rank") then
							local a = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("NOOB"):Clone()
							a.Name = "Rank"
							a.Parent = char:WaitForChild("Head")
						end
						
					elseif CheckValue.Value >= 51 and CheckValue.Value < 150 then
						
						if char:WaitForChild("Head"):FindFirstChild("Rank") then
							wait(3)	
							char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()	
						end	
									 
						if not char:WaitForChild("Head"):FindFirstChild("Rank") then				
							local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("BETTER"):Clone()
							b.Name = "Rank"
							b.Parent = char:WaitForChild("Head")
						end
						
			end
		end)
	end)
end)

Why does this script only work for the top part, and not the "else if" part in line 48? So like, if you have more then the required level it still gives the lower rank...

1 comment

0

wth is happening here,

1 answer

You have an elseif after an end without an if (line 48)

end

elseif CheckValue.Value >= 51 and CheckValue.Value < 150 then -- this is the error

This discussion is preserved as it was. New answers, comments, and votes are closed.