Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why does my script not work at the elseif part?

Asked by 4 years ago

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...

0
wth is happening here, RobloxGameingStudios 145 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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
Ad

Answer this question