Issue with potion effects... please help

Once again, got issues with the difficulty chart.

Yeah, I suck at scripting. I am trying to get better but these problems keep arising that I have no idea how to fix.

So i have a multitude of problems, but the one this post will try to slide tackle is the fact that i have no clue how to make you able to purchase these effects both with coins and robux.

So basically you can purchase 3 (now 2 because the mixed pot is bugged) different effects: speed, jump, or both (not anymore). I correctly scripted the purchasing and actual mechanic of each of them with coins, but not with robux.

effectclient (localscript)

local plr = game.Players.LocalPlayer

local shop = script.Parent.Shop.Shadow

local sframe = shop.Frame.ScrollingFrame

local toggle = plr.PlayerGui.EffectToggle.Shadow

local jump = sframe.GravityPot.CoinsButton

local speed = sframe.SpeedPot.CoinsButton

local mixed = sframe.MixedPot.CoinsButton

local jumpprice = 250

local speedprice = 250

local mixedprice = 350

local rs = game:GetService("ReplicatedStorage")

local jumppayevent = rs.JumpPayEvent

local speedpayevent = rs.SpeedPayEvent

local mixedpayevent = rs.MixedPayEvent

jump.MouseButton1Click:Connect(function()

if plr.leaderstats.Coins.Value >= jumpprice then

jumppayevent:FireServer(jumpprice)

end

end)

speed.MouseButton1Click:Connect(function()

if plr.leaderstats.Coins.Value >= speedprice then

speedpayevent:FireServer(speedprice)

end

end)

mixed.MouseButton1Click:Connect(function()

if plr.leaderstats.Coins.Value >= mixedprice then

mixedpayevent:FireServer(mixedprice)

end

end)

local plr = game.Players.LocalPlayer

local shop = script.Parent.Shop.Shadow
local sframe = shop.Frame.ScrollingFrame

local toggle = plr.PlayerGui.EffectToggle.Shadow

local jump = sframe.GravityPot.CoinsButton
local speed = sframe.SpeedPot.CoinsButton
local mixed = sframe.MixedPot.CoinsButton

local jumpprice = 250
local speedprice = 250
local mixedprice = 350

local rs = game:GetService("ReplicatedStorage")
local jumppayevent = rs.JumpPayEvent
local speedpayevent = rs.SpeedPayEvent
local mixedpayevent = rs.MixedPayEvent

jump.MouseButton1Click:Connect(function()
	if plr.leaderstats.Coins.Value >= jumpprice then
		jumppayevent:FireServer(jumpprice)
	end
end)

speed.MouseButton1Click:Connect(function()
	if plr.leaderstats.Coins.Value >= speedprice then
		speedpayevent:FireServer(speedprice)
	end
end)

mixed.MouseButton1Click:Connect(function()
	if plr.leaderstats.Coins.Value >= mixedprice then
		mixedpayevent:FireServer(mixedprice)
	end
end)

while true do
	if plr.Character then
		if toggle.Frame.EnableButton.Visible == true and plr.Character:WaitForChild("Humanoid").WalkSpeed == 16 then
			plr.Character:WaitForChild("Humanoid").JumpHeight = 14.4
		elseif toggle.Frame.EnableButton.Visible == true and plr:WaitForChild("Character").Humanoid.JumpPower == 7.2 then
			plr.Character:WaitForChild("Humanoid").WalkSpeed = 32
		end
	end
	wait(.1)
end

servereffects (serverscript)

local rs = game:GetService("ReplicatedStorage")
local jumppayevent = rs.JumpPayEvent
local speedpayevent = rs.SpeedPayEvent
local mixedpayevent = rs.MixedPayEvent

local paydeb = true

jumppayevent.OnServerEvent:Connect(function(player, jumpprice)
	if paydeb == true then
		paydeb = false
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - jumpprice
		wait(300)
		paydeb = true
	end
end)

speedpayevent.OnServerEvent:Connect(function(player, speedprice)
	if paydeb == true then
		paydeb = false
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - speedprice
		wait(300)
		paydeb = true
	end
end)

mixedpayevent.OnServerEvent:Connect(function(player, mixedprice)
	if paydeb == true then
		paydeb = false
		player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - mixedprice
		wait(300)
		paydeb = true
	end
end)

game.Players.PlayerAdded:Connect(function(player)
	while true do
		if paydeb == false then
		
			local shop = player:WaitForChild("PlayerGui").Shop.Shadow
			local sframe = shop.Frame.ScrollingFrame

			local jump = sframe.GravityPot.CoinsButton
			local speed = sframe.SpeedPot.CoinsButton
			local mixed = sframe.MixedPot.CoinsButton
			
			local toggle = player.PlayerGui:WaitForChild("EffectToggle").Shadow
			
			jump.TextColor3 = Color3.new(0.784314, 0.784314, 0.784314)
			jump.BackgroundColor3 = Color3.new(0.403922, 0.403922, 0.403922)
			jump.Text = "Effect Active"

			speed.TextColor3 = Color3.new(0.784314, 0.784314, 0.784314)
			speed.BackgroundColor3 = Color3.new(0.403922, 0.403922, 0.403922)
			speed.Text = "Effect Active"
			
			mixed.TextColor3 = Color3.new(0.784314, 0.784314, 0.784314)
			mixed.BackgroundColor3 = Color3.new(0.403922, 0.403922, 0.403922)
			mixed.Text = "Effect Active"
			
			toggle.Visible = true
			
		elseif paydeb == true then
			
			local shop = player:WaitForChild("PlayerGui"):WaitForChild("Shop").Shadow
			local sframe = shop.Frame.ScrollingFrame
			
			local toggle = player.PlayerGui:WaitForChild("EffectToggle").Shadow
			
			local jump = sframe.GravityPot.CoinsButton
			local speed = sframe.SpeedPot.CoinsButton
			local mixed = sframe.MixedPot.CoinsButton
			
			jump.TextColor3 = Color3.new(0.498039, 0.498039, 0.498039)
			jump.BackgroundColor3 = Color3.new(1, 0.717647, 0)
			jump.Text = "250 Coins"

			speed.TextColor3 = Color3.new(0.498039, 0.498039, 0.498039)
			speed.BackgroundColor3 = Color3.new(1, 0.717647, 0)
			speed.Text = "250 Coins"

			mixed.TextColor3 = Color3.new(0.498039, 0.498039, 0.498039)
			mixed.BackgroundColor3 = Color3.new(1, 0.717647, 0)
			mixed.Text = "350 Coins"
			
			toggle.Visible = false
			
		end
		wait(.1)
	end
	
end)

I’ve come up with a general format on how it could work, but due to a line in the other code, it just almost instantly makes the gui invisible again.

if receiptInfo.ProductId == paidjumppot then
		local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
		local toggle = player.PlayerGui.EffectToggle.Shadow
		if player.Character then
			toggle.Visible = true
			if toggle.Frame.EnableButton.Visible == true and player.Character:WaitForChild("Humanoid").WalkSpeed == 16 then
				player.Character:WaitForChild("Humanoid").JumpHeight = 14.4
			elseif toggle.Frame.EnableButton.Visible == true and player:WaitForChild("Character").Humanoid.JumpPower == 7.2 then
				player.Character:WaitForChild("Humanoid").WalkSpeed = 32
			end
		end
	elseif receiptInfo.ProductId == paidspeedpot then
		
	elseif receiptInfo.ProductId == paidmixedpot then
		
	end

So the elseifs are blank coz i dont feel like c and p’ing a script that doesnt work

if you have any suggestions on any of the code in general, let me know.

If anyone could help me out with this that would be great