Please help, my second last "end" is red underlined?
game.Players.PlayerAdded:Connect(function(player) script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then --Player One-- local Gui = script.Parent.Parent.PlayersInMatchPart.PlayersInMatchGui if Gui.Player1.Taken.Value == 1 then --Adding Player to Board Gui.Player1.Taken.Value = 2 Gui.Player1.PlayerProfileImage.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userid="..player.UserId Gui.Player1.PlayerLabel.Text = player.Name end --Player Two-- elseif Gui.Player2.Taken.Value == 1 then print("test") end end end) --This one end)
it is because you did
if Gui.Player1.Taken.Value == 1 then --Adding Player to Board Gui.Player1.Taken.Value = 2 Gui.Player1.PlayerProfileImage.Image = "http://www.roblox.com/Thumbs/Avatar.ashx? x=100&y=100&Format=Png&userid="..player.UserId Gui.Player1.PlayerLabel.Text = player.Name end --Player Two-- elseif Gui.Player2.Taken.Value == 1 then print("test") end
you shouldn't have two ends in an if statement with an elseif
---------------- --improper use-- ---------------- if condition then end elseif condition2 then end -------------- --proper use-- -------------- if condition then elseif condition2 then end
so your script should look like this
game.Players.PlayerAdded:Connect(function(player) script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then --Player One-- local Gui = script.Parent.Parent.PlayersInMatchPart.PlayersInMatchGui if Gui.Player1.Taken.Value == 1 then --Adding Player to Board Gui.Player1.Taken.Value = 2 Gui.Player1.PlayerProfileImage.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userid="..player.UserId Gui.Player1.PlayerLabel.Text = player.Name --Player Two-- elseif Gui.Player2.Taken.Value == 1 then print("test") end end end) end)
as always, if there is anything I'm overlooking, just comment