Ad
Still have questions? Join our Discord server and get real time help.
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 2 months 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 — 2mo
0
see Verdomme's answer iiMegabyteGaming 654 — 2mo
0
I don't think you defined ammo correctly. Try rereading and rewriting your code. Brady1290 0 — 2mo

1 answer

Log in to vote
2
Answered by 2 months ago
Edited 2 months 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 — 2mo
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 1162 — 2mo
Ad

Answer this question