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 3 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 — 3y
0
see Verdomme's answer zadobyte 692 — 3y
0
I don't think you defined ammo correctly. Try rereading and rewriting your code. Brady1290 0 — 3y

1 answer

Log in to vote
3
Answered by 3 years ago
Edited 3 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 — 3y
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 — 3y
Ad

Answer this question