Hi, I’m making one of those EA games where you basically have to pay to do stuff like walk, jump, etc. Although I have managed to make it so you need to pay once to walk and again to jump, everytime the player dies and respawn, the prompt appears and they have to pay everytime they respawn which is not what I want. I tried using BoolValues to make it check if they have bought it but it doesn’t work.
Local script inside the StarterGui
local player = game.Players.LocalPlayer
local char = player.Character
local walking = false
local jumping = false
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D then
if player.PlayerGui.bools.walking.Value == false then
if debounce == false then
debounce = true
game:GetService("ReplicatedStorage").purchases:FireServer(1)
wait(5)
debounce = false
end
end
elseif input.KeyCode == Enum.KeyCode.Space then
if player.PlayerGui.bools.jumping.Value == false then
if debounce == false then
debounce = true
game:GetService("ReplicatedStorage").purchases:FireServer(2)
wait(5)
debounce = false
end
end
end
end)
char:WaitForChild("Humanoid").Died:Connect(function()
if player.PlayerGui.bools.walking.Value == true then
print("player died with walking purchased")
walking = true
end
if player.PlayerGui.bools.jumping.Value == true then
print("player died with jumping purchased")
jumping = true
end
end)
player.CharacterAdded:Connect(function()
print("character loaded, checking")
if walking == true then
print("sending remote to server to make player be able to walk")
game:GetService("ReplicatedStorage").respawn:FireServer(1)
player.PlayerGui.bools.walking.Value = true
end
if jumping == true then
print("sending remote to server to make player be able to jump")
game:GetService("ReplicatedStorage").respawn:FireServer(2)
player.PlayerGui.bools.jumping.Value = true
end
end)
Server script which handles the purchases, stored inside ServerScriptService
local event = game:GetService('ReplicatedStorage').purchases
local marketplace = game:GetService("MarketplaceService")
local players = game:GetService("Players")
event.OnServerEvent:Connect(function(user, numb)
if numb == 1 then
marketplace:PromptProductPurchase(user, 1293370844)
elseif numb == 2 then
marketplace:PromptProductPurchase(user, 1293379944)
end
end)
local function processreceipt(receiptinfo)
local player = players:GetPlayerByUserId(receiptinfo.PlayerId)
local char = game.Workspace:FindFirstChild(player.Name)
if receiptinfo.ProductId == 1293370844 then
char.Humanoid.WalkSpeed = 16
player.PlayerGui.bools.walking.Value = true
elseif receiptinfo.ProductId == 1293379944 then
char.Humanoid.JumpPower = 50
player.PlayerGui.bools.jumping.Value = true
end
end
marketplace.ProcessReceipt = processreceipt
game:GetService("ReplicatedStorage").respawn.OnServerEvent:Connect(function(player, numb)
local char = player.Character
if numb == 1 then
char.Humanoid.WalkSpeed = 16
elseif numb == 2 then
char.Humanoid.JumpPower = 50
end
end)
The bools are stored inside the StarterGui so its both accesed by the client and server side, inside a folder.

How can I fix this problem?