So I made a script that is when you click a button you purchase it, when you click the ImageButton, it is instead trying to make the purchase again. Does anybody know why this is happening? Code:

script.Parent.ImageButton.MouseButton1Click:Connect(function()
	if market:UserOwnsGamePassAsync(player.UserId,8436874) then
		game.ReplicatedStorage.onGamepass:FireServer()
		local goal = {
			Rotation = 15
		}
		local tween = TweenInfo.new(0.5)
		local t = tweenService:Create(script.Parent.ImageButton,tween,goal)
		t:Play()
		wait(0.5)
		local goal = {
			Rotation = 0
		}
		local tween = TweenInfo.new(0.5)
		local t = tweenService:Create(script.Parent.ImageButton,tween,goal)
		t:Play()
	else
		market:PromptGamePassPurchase(player,8436874)
	end
end)

Let's say that you have 50 Robux. You click 'OK' to buy it. And when you click the ImageButton again, it says 'After this transaction, you will have 30 Robux.' or something like that. And before it would say 'After this transaction, you will have 40 Robux.' or something like that. Does anybody know why this is happening?

Thanks, b_mni.

2 comments

0

Where are all the services defined, I don't see them defined anywhere

0

oh this is only part of script