I am making a simple Cash leaderstats thing which works based off of parts called coins that are each colored differently. Each are colored colored for bronze, silver, and gold. Each coin works as far as giving their correct value and etc. The only real problem is that I don't know how to make them go back down(as when they're touched they're Vector3's y axis goes up).

script:



for i,v in pairs(game.Workspace:GetChildren()) do
	if v.Name == "Coin" then
		v.Touched:connect(function(hit)
			C = hit.Parent.Name
			lel = game.Players:FindFirstChild(C)
			if lel then
				Cash = lel.leaderstats.Cash
			end
			if v.BrickColor == BrickColor.new(106)then
				Cash.Value = Cash.Value + 5
				wait(.1)
				v.Transparency = 1
				wait(10)
				v.Transparency = 0
				wait(1)
			end
			if v.BrickColor == BrickColor.new(329)then
				Cash.Value = Cash.Value + 10
				v.Transparency = 1
				wait(10)
				v.Transparency = 0
				wait(1)
			end
			if v.BrickColor == BrickColor.new(24)then
				Cash.Value = Cash.Value + 15
				v.Transparency = 1
				wait(10)
				v.Transparency = 0
				wait(1)
			end
		end)
	end
end

4 comments

0

Are you setting the parts to go up, or is that not meant to happen?

0

they're not meant to go up

0

What is "go up?" There isn't anything in the script you've shared that has anything to do with "up" or any sort of movement.

0

I mean when it's touched it does something like thisd (if u looked at it's properties): before - Pos = Vector3.new(random number, 0.5, random number) after being touched - Pos = Vector3.new(randomnumber, 4+, randomnumber)