I am making a script so that if you own a gamepass, the script removes one of the Gears. If you do not, then it removes the other. However, all I get is on one of the ends, theres meant to be a ) to close line 3, which is put at the end. Is this an easy fix?
local passid = 0000000000 local GamePassService = Game:GetService('GamePassService') game.Players.PlayerAdded:connect(function(player) repeat wait(0.1) until player.Backpack repeat wait(0.1) until player.StarterGear if GamePassService:PlayerHasPass(player, passid) then script.Parent.RobloxPhoneSmartphone:Remove() else script.Parent["RobloxPhone Mobile"]:Remove() end end end end)
Tab your code!
local passid = 0000000000 local GamePassService = Game:GetService('GamePassService') game.Players.PlayerAdded:connect(function(player) repeat wait(0.1) until player.Backpack repeat wait(0.1) until player.StarterGear if GamePassService:PlayerHasPass(player, passid) then script.Parent.RobloxPhoneSmartphone:Remove() else script.Parent["RobloxPhone Mobile"]:Remove() end end end end)
Look at the last two lines! You have two end
s which are already at the far left. You only needed 1) for the if
and 2) for the function
.
Your repeat
loops are not accomplishing anything. In the event that player.Backpack
or player.StarterGear
hasn't loaded, it will just error because you are accessing a child that hasn't loaded.
Use the :WaitForChild
method instead.