Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

So I'm making a gun it works but the ammo won't show in my TextLabel, can anyone help?

Asked by 4 years ago
local ammo = script.Parent.Ammo.Value
local ammoGui = game.StarterGui.GunGui.BackgroundFrame.AmmoDisplay

local function onUpdateAmmoDisplay()
    while wait() do
        ammoGui.Text = ammo.."/"..maxAmmo
    end
end
spawn(onUpdateAmmoDisplay)


0
I know it's a stupid question, but I can't figure it out lol NicoXerocious 29 — 4y
0
see Verdomme's answer zadobyte 692 — 4y
0
I don't think you defined ammo correctly. Try rereading and rewriting your code. Brady1290 0 — 4y

1 answer

Log in to vote
3
Answered by 4 years ago
Edited 4 years ago

you are modifying the StarterGui, everything thats inside the startergui gets cloned into the PlayerGui of a player so if you modify something in StarterGui it will only show after the players dies so if you want the modify it instantly you have to modify the PlayerGui

the PlayerGui is part of the player. like this Player.PlayerGui

0
@VerdommeMan Thank you so much! That saved me hours! NicoXerocious 29 — 4y
0
No problem also i think brady i s rigth, ammo has the value Ammo.Value, but not the reference of Ammo so anything u change to ammo riight now will not affect Ammo (ammo being here the name of var and Ammo is script.Parent.Ammo)) VerdommeMan 1479 — 4y
Ad

Answer this question