You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve?
A selling script that actually works!
- What is the issue?
The issue is everytime I got to sell it works and it puts the strength value to 0 but when I click I am supposed to get like +1 but is is going back to the same number that I sold, how can I fix this?
- What solutions have you tried so far?
Finding a solution!
local debounce = false
function getMultiplier(Player, multiplierName)
local Multi = 1
for i,v in pairs(Player.Pets:GetChildren()) do
if v.Equipped.Value == true then
Multi = Multi + v[multiplierName].Value
end
end
return Multi
end
local id = 24229395
local sell = game.Workspace.SellingParts.SellingPart1
local player = game.Players.LocalPlayer
local sound = sell.CoinSound
sell.Touched:Connect(function()
if debounce == false then
local leaderstats = player:WaitForChild("leaderstats")
local currency = leaderstats.Coins
local selling = leaderstats.Strength
if selling.Value > 0 then
debounce = true
sound:Play()
wait(0.1)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) then
currency.Value = currency.Value + selling.Value * getMultiplier(player, "Multiplier1") * player.RankMultiplier.Value * 1
selling.Value = 0
player.Level.Exp.Value = player.Level.Exp.Value + 1
debounce = false
else
currency.Value = currency.Value + selling.Value * getMultiplier(player, "Multiplier1") * player.RankMultiplier.Value
selling.Value = 0
player.Level.Exp.Value = player.Level.Exp.Value + 1
debounce = false
end
end
end
end)
Thank you in advance!