#Touch Counter ( SOLVED )

34 messages · Page 1 of 1 (latest)

barren pivot
#

your using startergui

#

directly access it or use a remote for updating ui

final field
#

Youre using game.StarterGui to modify the text

#

StarterGui is for cloning the gui into the player's special PlayerGui container

#

The only way to change the current player's gui from another script is with Player.PlayerGui

#

Heres what I mean:

#
local Player = game:GetService("Players").LocalPlayer
local BadgeAwarders = script.Parent 
local BadgeAwarded = Player.PlayerGui.BadgeRateUI.BadgeAwarded
local BadgeAwardedNumber = 0 

local function updateCounter()
    BadgeAwardedNumber = BadgeAwardedNumber + 1
    BadgeAwarded.Text = tostring(BadgeAwardedNumber)
end

for _, object in pairs(BadgeAwarders:GetChildren()) do
    if object:IsA("BasePart") then
        object.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild("Humanoid") then 
                updateCounter()
            end
        end)
    end
end
#

Try this out

sinful helm
#

c

warped nexusBOT
#

studio** You are now Level 6! **studio

final field
#

Um

#

Already found the issue

#

LocalScripts dont run if they are in workspace 💀

#

Put GUIManager in the actual gui

final field
#

it works?

#

lmao

#

no problem

#

Korbloxster

#

However, heres an issue

#

If you collect one badge and just keep touching the same badge part the counter still goes up

#

Alright

#

Just sayin

#

um

warped nexusBOT
#

studio** You are now Level 6! **studio

final field
#

Maybe dont use the GameId lol

#

that number is just an identifier for your whole experience

#

What youre looking for is .PlaceId

#

Its the id of the current place you are editing rn

final field
#

i got a built-in compiler lmao

#

4 years wasnt worth for nothing

final field
#

well uh

#

i said that as a joke lmao

#

a compiler is what makes the source code into a thing your computer can read to do whatever you wrote

#

like