So I'm making a game with classes, so I made a localscript with a few lines making BoolValues of each class. And that works because when I inspect player, there are all of the classes.
So I already made the script to give you the class items, and that works too.
The problem I have now Is trying to make a script that prevents you from re-clicking the Gui to change to that class if you're already that class.
Here's the script:
textButton = script.Parent
spawns = {game.Workspace.SpawnLocation1 , game.Workspace.SpawnLocation2 , game.Workspace.SpawnLocation3 , game.Workspace.SpawnLocation4}
player = script.Parent.Parent.Parent.Parent
Trowel = game.ReplicatedStorage.ClassicTrowel:Clone()
Builder = player:WaitForChild("Builder")
textButton.MouseButton1Down:connect(function()
if Builder.Value == false then
Builder.Value = true
script.Parent.Text = "5"
wait(1)
script.Parent.Text = "4"
wait(1)
script.Parent.Text = "3"
wait(1)
script.Parent.Text = "2"
wait(1)
script.Parent.Text = "1"
wait(1)
player.Character:MoveTo(spawns[math.random(1, #spawns)].Position)
player.Character.Humanoid.MaxHealth = 200
player.Character.Humanoid.Health = 200
Trowel:Clone().Parent = player.Backpack
Trowel:Clone().Parent = player.StarterGear
script.Parent.Text = "Change to Builder"
end
end)
else
return
end
I know there's an error, and it's been annoying me. It says:
'' expected near 'else'
I know that means that there should be whitespace where that is, but that completely erases the else part.
I have trouble with these conditional statements and where to place my 'ends'

1 comment
The 'else' and 'elseif' type methods are used inside of a 'if then' statement, your 'else' is outside of one looking at your code.