Very bugged coin system, Help!

what does that do?
image
Also the problem is the leaderstats gets updated with no debouce, the wait() next to false won’t work because thats kinda useless

(Also gtg)

i mean this

function onTouch(part)

	print("Touched")

	if part.Parent:FindFirstChild("Humanoid") then
		local Human = part.Parent.Humanoid

		if Debounce then return end

		if Human then
			local Player = Players:GetPlayerFromCharacter(Human.Parent)

			if Player then
				local leaderStat = Player:FindFirstChild("leaderstats") :FindFirstChild("EggCoins")

				if leaderStat then
					leaderStat.Value += Amount
				else
					warn("No Leaderstat")
				end
			else
				warn("No Player")
			end
		
			Debounce = true
			script.Parent.Music:Play()
			script.Parent.Day.Enabled = true
			script.Parent.Transparency = 1

			task.wait(1.25)
			script.Parent.Day.Enabled = false
			script.Disabled = true

			task.wait(WaitTime - 1.25)
			script.Parent.Transparency = 0
			script.Disabled = false	
			Debounce = false
		
		else
			warn("No Human")
		end
	end
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.