How can i make a ui change collour when you touch a part

i want to make a ui that tells you how many items you have collected
the way i want to do this is make a ui that shows all the collectibles and when you touch the item it lights up

how can i make this?

You would just use the part touched event and when the part.tocuhed has been fired you would just change the colour of the UI.

--local script

--//Variables
local Part = game.Workspace:WaitForChild("MyPart")
local Players = game:GetService("Players")
local GUI = script.Parent.MyText -- change it to where and what your UI object is [textlabel,textbutton,etc]
--//Events
Part.Touched:Connect(function(Object)
   if Players:FindFirstChild(Object.Parent.Name) == nil then return end
   GUI.TextColor3 = Color3.FromRGB(0,0,0) -- Change to desired color
end)

Mark it as a solution so others will see it!

where would i put the local script sry i dont know anything about scripting

You should place the local script inside the gui

1 Like