Hey scriptinghelpers, I don't know how else to word the title. I'm having problems with this, I thought it fixed but, I guess I didn't. I had players in my game purchasing the game pass from the prompt. For some reason, the script just stopped working. I don't understand why because, everything looks fine to me? I was considering taking off the debounce but, I don't know. This is kinda confusing me so I thought I would ask for help. Below is my script and where and what it is.

This is a script inside of a part. (It's used to change fire color on touch or prompt purchase)

local debounce = true
local MarketplaceService = game:GetService("MarketplaceService")
local GamepassId = 17468467
script.Parent.Touched:Connect(function(hit)
	if debounce == true and hit.Parent:FindFirstChild("Humanoid") then
		local character = hit.Parent
		local player = game:GetService("Players"):GetPlayerFromCharacter(character)
		if not MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) then
			MarketplaceService:PromptGamePassPurchase(player, GamepassId)
		elseif player and MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) and player.leaderstats.Tix.Value >= 420000 then
			debounce = false
			local avatar = character:GetChildren()
			for _,t in pairs(avatar) do
				if t.ClassName == "Part" then
					local fire = t.Fire
					fire.Color = Color3.new(0.19607843137,0,0.19607843137)
					fire.SecondaryColor = Color3.new(0,1,0)
				end
			end
		end
		wait(1)
		debounce = true
	end
end)

Thanks for the help in advance. I appreciate any advice and help, I'm only here to learn!

3 comments

1

Does it print anything in output?

0

I'm not getting any output when I test it no, which is really confusing. It seems to happen when I have multiple players.

0

If I removed the debounce would it work? Basically it's like it gets locked up with a false debounce (I'm assuming but I'm not certain) and it just stops working.