Is there a way I can save this value to a player?
Asked by
5 years ago Edited 5 years ago
local PurchaseGun = game:GetService("ReplicatedStorage").PurchaseGun
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GunPrices = {
["Pistol"] = 100,
["Revolver"] = 300,
["Uzi"] = 750
}
PurchaseGun.OnServerEvent:Connect(function(Player, GunName)
if GunName == "DefaultGun" then
return
end
local Cash = Player:FindFirstChild("leaderstats").Cash
if Cash.Value >= GunPrices[GunName] then
Cash.Value = Cash.Value - GunPrices[GunName]
local clonegun = ReplicatedStorage.Guns:FindFirstChild(GunName)
local Owned = Player.PlayerGui.Gui.Main.ShopF.ShopF:FindFirstChild(GunName).Owned
Owned.Visible = true
local DisableScript = Player.PlayerGui.Gui.Main.ShopF.ShopF:FindFirstChild(GunName).Script
DisableScript.Disabled = true
local pp = Player.PlayerGui.Gui.Main.PromptPurchase
pp.Visible = false
local Purchased = Player.PlayerGui.Gui.Main.ShopF.ShopF:FindFirstChild(GunName).Purchased
Purchased.Value = 1 -- this is the value I wanna save to the player
local Open = Player.PlayerGui.Gui.Main.PromptPurchase.Open
Open.Value = 0
clonegun:Clone().Parent = Player.Backpack
end
end)