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

How do i get my text GUI to update properly?

Asked by 2 years ago

I checked through the website and all of the results i wanted didnt help fix my issue so i am now asking for help. I am having an issue with a gui changing script where the printing works properly but hte GUI doesnt update at all. the code is:

--instances
local Player = game:GetService("Players").LocalPlayer
local Text = script.Parent.Text
local Color = script.Parent.TextColor
local Textchange = script.Parent.TextChange
--functions
local function SetText(Ammo, Ammocap)
    print(Ammo.."/"..Ammocap)
    print("before if argument")
    if Ammo / Ammocap < 1.5 then
        Color = Color3.new(0.807843, 0, 0)
        print("in if argument")
    end
    print("after if argument")
    Text = Ammo.."/"..Ammocap
end

--function connects
Textchange.Event:Connect(function(Ammo, Ammocap)
    print("triggered Bindable Event")
    SetText(Ammo, Ammocap)
end)

alos i am certain that all of my instances are correct, hte text just doesnt update correctly

0
just so everyone knows all of the prints are to check bugs Verse_NOVA 52 — 2y
0
just so everyone knows all of the prints are to check bugs Verse_NOVA 52 — 2y
0
The names of the instances are properties and the script will get confused MattVSNNL 620 — 2y
0
what do you mean the script will get confused? the Ammo and Ammocap are numbers all the time so it should work Verse_NOVA 52 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

I would recommend testing if tostring() works. I'm assuming Ammo and Ammocap are ints, meaning when you try to append a string to them it doesn't automatically change them. So test if this works on line 15: Text= tostring(Ammo).."/"..tostring(Ammocap), if it does please mark this as the answer, otherwise comment on this if there's an error or anything! Good Luck

Ad

Answer this question