Help with Attributes

Hi I am Making an Attribute in a Ball thats text is whoever touched it but it dont seem to work

ball = script.Parent
local att = ball:GetAttribute("LastTouch")


ball.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChildOfClass("Humanoid") then
		att = hit.Parent.Name
	end
	
end)

help is appreciated!

Hi, what’s happening is your att variable is set to the lastTouch attribute (which I’m assuming is nil by runtime). Then, once the ball is touched, you set that att variable to hit.Parent.Name. You didn’t change the attribute value, but you just changed what the att variable refers to (first, it refers to LastTouch attribute, then it refers to hit.Parent.Name).
If you wish to actually set the value of the LastTouch attribute, you would write the following:

ball:SetAttribute("LastTouch", hit.Parent.Name)

instead of

 att = hit.parent.Name

You also will not have a need for the att variable

I tried it and it worked!, but I reset the attribute text to nothing in testing mode and i touched it, and my name didnt show

TLDR It only texts my username once.