How is this possible?
Whenever I buy a product (in this case, Walk) and I leave the game and I rejoin, it shows as TRUE?!
This should be impossible. There is no datastore saving anything. Does anybody know what is going on?
How is this possible?
Whenever I buy a product (in this case, Walk) and I leave the game and I rejoin, it shows as TRUE?!
This should be impossible. There is no datastore saving anything. Does anybody know what is going on?
MarketPlaceService
I’m guessing is what you use to buy gamepasses or products, so obviously it would save it in the roblox database. Can you also show the code written?
This has never happened to me before though.
Server
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local function PlayerAdded(Player)
local Walk = Instance.new("BoolValue")
Walk.Name = "Walk"
Walk.Value = false
Walk.Parent = Player
local Jump = Instance.new("BoolValue")
Jump.Name = "Jump"
Jump.Value = false
Jump.Parent = Player
local Chat = Instance.new("BoolValue")
Chat.Name = "Chat"
Chat.Value = false
Chat.Parent = Player
local ChatsLeft = Instance.new("NumberValue")
ChatsLeft.Name = "ChatsLeft"
ChatsLeft.Value = 0
ChatsLeft.Parent = Player
Player.Chatted:Connect(function(Message)
if Player.Chat.Value == false then
ReplicatedStorage.CantSpeak:FireAllClients(Player)
elseif Player.Chat.Value == true then
if Player.ChatsLeft.Value <= -1 then
Player.Chat.Value = false
ReplicatedStorage.CantSpeak:FireAllClients(Player)
end
Player.ChatsLeft.Value -= 1
if Player.ChatsLeft.Value <= -1 then
Player.Chat.Value = false
ReplicatedStorage.CantSpeak:FireAllClients(Player)
end
end
end)
Player.CharacterAdded:Connect(function(Character)
Character.Humanoid.UseJumpPower = true
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.JumpPower = 0
end)
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == 1270745136 then --walk
local Player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
Player.Walk.Value = true
Player.Character.Humanoid.WalkSpeed = 16
elseif receiptInfo.ProductId == 1270745251 then --jump
local Player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
Player.Jump.Value = true
Player.Character.Humanoid.UseJumpPower = true
Player.Character.Humanoid.JumpPower = 50
elseif receiptInfo.ProductId == 1270745530 then --chat
local Player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
Player.Chat.Value = true
Player.ChatsLeft.Value = 5
end
end
local function PlayerRemoving(Player)
Player.Chat.Value = false
Player.Walk.Value = false
Player.Jump.Value = false
Player.ChatsLeft.Value = 0
end
for _, Player in ipairs(Players:GetPlayers()) do
PlayerAdded(Player)
end
Players.PlayerAdded:Connect(PlayerAdded)
Players.PlayerRemoving:Connect(PlayerRemoving)
Client:
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local MarketplaceService = game:GetService("MarketplaceService")
local Player = Players.LocalPlayer
local walkTable = {
Enum.KeyCode.W;
Enum.KeyCode.A;
Enum.KeyCode.S;
Enum.KeyCode.D;
Enum.KeyCode.Up;
Enum.KeyCode.Left;
Enum.KeyCode.Down;
Enum.KeyCode.Right;
}
UserInputService.InputBegan:Connect(function(Input, Processed)
if Processed then return end
if table.find(walkTable, Input.KeyCode) then
warn("FIRED")
if Player:WaitForChild("Walk").Value == false then
warn("PROMPTING")
MarketplaceService:PromptProductPurchase(Player, 1270745136)
end
elseif Input.KeyCode == Enum.KeyCode.Space then
warn("FIRED")
if Player:WaitForChild("Jump").Value == false then
warn("PROMPTING")
MarketplaceService:PromptProductPurchase(Player, 1270745251)
end
end
end)
UserInputService.TouchMoved:Connect(function(Input, Processed)
if Processed then return end
if Player:WaitForChild("Walk").Value == false then
MarketplaceService:PromptProductPurchase(Player, 1270745136)
end
end)
What did ChatsLeft
value print? It seems like we need to debug this.
Where do you want me to print that?
Also, it’s the ProcessReceipt function. I just tested it by ignoring that out, and then every value is false. When I unignored it, it’s set to the ‘previous’ data.
You can do checks such as:
if val:IsA("BoolValue") or val:IsA("NumberValue") then
-- code here
end