Ammo gui isn't working on a gun, can somebody help me with what I've done wrong?
I got an ammo gui ed with a LocalScript but it aparently doesn't work :/
01 | local players = game:GetService( "Players" ) |
02 | local player = players.LocalPlayer |
04 | local ammo = .Parent:WaitForChild( 'CurrentAmmo' ).Value |
05 | local maxammo = .Parent:WaitForChild( 'MaxAmmo' ).Value |
07 | weapon.Equipped:connect( function () |
08 | local gui = Instance.new( 'ScreenGui' , player.PlayerGui) |
09 | gui.Name = 'WeaponGui' |
10 | local currentammogui = Instance.new( 'TextBox' , gui) |
11 | currentammogui.Name = 'CurrentAmmo' |
12 | currentammogui.Text = 'Current: ' ..ammo |
13 | currentammogui.Size = UDim 2. new( 0.17 , 0 , 0.07 , 0 ) |
14 | currentammogui.Position = UDim 2. new( 0.81 , 0 , 0.9 , 0 ) |
15 | currentammogui.BackgroundTransparency = 1 |
16 | currentammogui.FontSize = 'Size28' |
17 | currentammogui.Font = 'Code' |
18 | local maxammogui = Instance.new( 'TextBox' , gui) |
19 | maxammogui.Name = 'MaxAmmo' |
20 | maxammogui.Text = 'Max: ' ..maxammo |
21 | maxammogui.Size = UDim 2. new( 0.17 , 0 , 0.07 , 0 ) |
22 | maxammogui.Position = UDim 2. new( 0.81 , 0 , 0.85 , 0 ) |
23 | maxammogui.BackgroundTransparency = 1 |
24 | maxammogui.FontSize = 'Size28' |
25 | maxammogui.Font = 'Code' |
28 | ammo.Changed:connect( function (newammo) |
29 | local currentammogui = player.PlayerGui.WeaponGui:WaitForChild( 'CurrentAmmo' ) |
30 | currentammogui.Text = 'Current: ' ..newammo |
33 | weapon.Unequipped:connect( function () |
34 | player.PlayerGui.WeaponGui:Remove() |
Photo of how my Studio looks like:
http://prntscr.com/e7is61