Eventually, I'm going to make ranks, and you get different guns for each ranks. I made a script, and guess what? it doesn't work! I'm pretty sure it has A LOT of defects in it. Here is my script, plz help.
local StarterGui = game:GetService('StarterGui') StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character.Humanoid local WEAPON = Player.Backpack['M16'] local HumanoidRootPart = Character:WaitForChild('HumanoidRootPart') local GotGun = false local btn = game.StarterGui.ScreenGui.Frame.TextButton btn.MouseButton1Click:Connect(function() if GotGun == false then Humanoid:EquipTool(WEAPON) GotGun = true end end) if Humanoid.Health == 0 then Humanoid:UnequipTools() GotGun = false end