#Friend Boost

94 messages · Page 1 of 1 (latest)

potent pawn
#

no

#

merry christmas tho!

sturdy bough
#

that's not really helping

#

it's more like do it for me

low kettle
#

wdym

#

like

#

i just want the script

sturdy bough
#

howd you do it on phone?

low kettle
#

ty man

#

gimme a sec

#

this is a script on serverscriptservice right

#

okay gimme a sec

#

it shows like this , btw the leaderstat that im trynna boost is ( Strength )

#

lemme try to fix

#

wdym i didnt

rough merlinBOT
#

studio** You are now Level 8! **studio

low kettle
#

uhh just tell me if this is good i tried to remake it i didnt try it yet

rough merlinBOT
#

studio** You are now Level 2! **studio

low kettle
#

local player = game.Players.LocalPlayer
local strength = player:WaitForChild("Strength")
local IsUsingTool = false
local baseBoost = 1000

game.Players.PlayerAdded:Connect(function(guyWhoJoined)
strength.Value = 1

local friendCount = 0
for _, v in pairs(game.Players:GetChildren()) do
    if player:IsFriendsWith(guyWhoJoined.UserId) then
        friendCount = friendCount + 1
    end
end

local boostMultiplier = 1 + (friendCount * 0.1)

if IsUsingTool then
    strength.Value = strength.Value * baseBoost * boostMultiplier
else
    strength.Value = strength.Value * boostMultiplier
end

end)

#

yea

#

yea i created it on serverscriptservice

#

thats the leaderstat that i wanna boost

#

like if im using a tool that gives 1000 Strength , with 5 friends it will give 1500 and with 2 , 1200 , u know

#

lemme try it out

#

local script at starterplayerscript?

#

to work with tools i gotta put in on true right

#

wait

#

idk but when my friend joins my strength goes from 1.1 billon to 1.20K , then the boost wont work

#

it decreases my Strength

#

idk why

#

my strength was already 1.1 billon before he joined because i did some tool clicks

#

wdym globals?

#

yea

#

done

#

okay

#

uhh

#

im using this one

#

that

#

it gives 10%

#

for premium users

rough merlinBOT
#

studio** You are now Level 3! **studio

low kettle
#

idk it could help for this one scipt

#

local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")

local premiumGuiFolder = ServerStorage:WaitForChild("Premium")
local premiumScreenGui = premiumGuiFolder:WaitForChild("ScreenGui")

Players.PlayerAdded:Connect(function(player)
player:WaitForChild("leaderstats")
local strengthStat = player.leaderstats:FindFirstChild("Strength")

if player.MembershipType == Enum.MembershipType.Premium then
    local clonedGui = premiumScreenGui:Clone()
    clonedGui.Parent = player:WaitForChild("PlayerGui")

    if strengthStat then
        local previousValue = strengthStat.Value

        strengthStat:GetPropertyChangedSignal("Value"):Connect(function()
            local newValue = strengthStat.Value
            local difference = newValue - previousValue

            if difference > 0 then
                local boost = math.round(difference * 0.1)
                strengthStat.Value = previousValue + difference + boost
            end

            previousValue = strengthStat.Value
        end)
    end
end

end)

#

check that script

#

maybe u can found it

#

wdym

#

yea wait

#

local DataStoreService = game:GetService("DataStoreService")
local dataStore = DataStoreService:GetDataStore("PlayerData")

local suffixes = {"", "K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "Oc", "No", "Dc", "Ud", "Du", "Tr", "Qa", "Qi", "Se", "Sp", "Oc", "No", "Vi", "Un", "Dv", "Tv", "Qv", "Qv", "Sv", "Sv", "Ot", "Nv", "Tt"}

local function formatNumber(value)
local index = 1
while value >= 1000 and index < #suffixes do
value = value / 1000
index = index + 1
end
return string.format("%.1f%s", value, suffixes[index])
end

local function giveTokens(player)
while player.Parent do
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
leaderstats.Tokens.Value = leaderstats.Tokens.Value + 1
end
wait(1)
end
end

game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local tokens = Instance.new("NumberValue")
tokens.Name = "Tokens"
tokens.Parent = leaderstats

local strength = Instance.new("NumberValue")
strength.Name = "Strength"
strength.Parent = leaderstats

local money = Instance.new("NumberValue")
money.Name = "Money"
money.Parent = leaderstats

local success, data = pcall(function()
    return dataStore:GetAsync(tostring(player.UserId))
end)

if success and data then
    tokens.Value = data.Tokens or 0
    strength.Value = data.Strength or 0
    money.Value = data.Money or 0
else
    tokens.Value = 0
    strength.Value = 0
    money.Value = 0
end

spawn(function()
    giveTokens(player)
end)

end)

game.Players.PlayerRemoving:Connect(function(player)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local data = {
Tokens = leaderstats.Tokens.Value,
Strength = leaderstats.Strength.Value,
Money = leaderstats.Money.Value
}

    local success, err = pcall(function()
        dataStore:SetAsync(tostring(player.UserId), data)
    end)

    if not success then
        warn("Error guardando datos: " .. err)
    end
end

end)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local sellStrengthEvent = ReplicatedStorage:WaitForChild("SellStrengthEvent")

sellStrengthEvent.OnServerEvent:Connect(function(player)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local strength = leaderstats:FindFirstChild("Strength")
local money = leaderstats:FindFirstChild("Money")

    if strength and money and strength.Value > 0 then
        local strengthToSell = strength.Value
        strength.Value = 0
        money.Value = money.Value + strengthToSell

        local success, err = pcall(function()
            dataStore:SetAsync(tostring(player.UserId), {
                Tokens = leaderstats.Tokens.Value,
                Strength = strength.Value,
                Money = money.Value
            })
        end)

        if not success then
            warn("Error guardando datos después de vender Strength: " .. err)
        end
    end
end

end)

#

wth

#

!

#

for saving the leaderstat

#

if i left

#

right

#

so i gotta change something from leaderstat right

#

so what should i change real quick

#

oh

#

local strength = Instance.new("NumberValue")
strength.Name = "Strength"
strength.Parent = leaderstats

#

ok

#

if success and data then
tokens.Value = data.Tokens or 0
strength.Value = data.Strength or 0
money.Value = data.Money or 0
else
tokens.Value = 0
strength.Value = 0
money.Value = 0
end

#

dat

#

not really

#

someone helped me

#

with the leaderstat

#

something may be wrong

#

nah

#

ye

#

im from argentina

#

in console?

#

lemme check

#

no i dont really get a error

#

yes

#

why do u think that

#

lemme send the leaderstat script again

#

local DataStoreService = game:GetService("DataStoreService")
local dataStore = DataStoreService:GetDataStore("PlayerData")

local suffixes = {"", "K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "Oc", "No", "Dc", "Ud", "Du", "Tr", "Qa", "Qi", "Se", "Sp", "Oc", "No", "Vi", "Un", "Dv", "Tv", "Qv", "Qv", "Sv", "Sv", "Ot", "Nv", "Tt"}

local function formatNumber(value)
local index = 1
while value >= 1000 and index < #suffixes do
value = value / 1000
index = index + 1
end
return string.format("%.1f%s", value, suffixes[index])
end

local function giveTokens(player)
while player.Parent do
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
leaderstats.Tokens.Value = leaderstats.Tokens.Value + 1
end
wait(1)
end
end

game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local tokens = Instance.new("NumberValue")
tokens.Name = "Tokens"
tokens.Parent = leaderstats

local strength = Instance.new("NumberValue")
strength.Name = "Strength"
strength.Parent = leaderstats

local money = Instance.new("NumberValue")
money.Name = "Money"
money.Parent = leaderstats

local success, data = pcall(function()
    return dataStore:GetAsync(tostring(player.UserId))
end)

if success and data then
    tokens.Value = data.Tokens or 0
    strength.Value = data.Strength or 0
    money.Value = data.Money or 0
else
    tokens.Value = 0
    strength.Value = 0
    money.Value = 0
end

spawn(function()
    giveTokens(player)
end)

end)

game.Players.PlayerRemoving:Connect(function(player)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local data = {
Tokens = leaderstats.Tokens.Value,
Strength = leaderstats.Strength.Value,
Money = leaderstats.Money.Value
}

    local success, err = pcall(function()
        dataStore:SetAsync(tostring(player.UserId), data)
    end)

    if not success then
        warn("Error guardando datos: " .. err)
    end
end

end)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local sellStrengthEvent = ReplicatedStorage:WaitForChild("SellStrengthEvent")

sellStrengthEvent.OnServerEvent:Connect(function(player)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local strength = leaderstats:FindFirstChild("Strength")
local money = leaderstats:FindFirstChild("Money")

    if strength and money and strength.Value > 0 then
        local strengthToSell = strength.Value
        strength.Value = 0
        money.Value = money.Value + strengthToSell

        local success, err = pcall(function()
            dataStore:SetAsync(tostring(player.UserId), {
                Tokens = leaderstats.Tokens.Value,
                Strength = strength.Value,
                Money = money.Value
            })
        end)

        if not success then
            warn("Error guardando datos después de vender Strength: " .. err)
        end
    end
end

end)

#

okay

#

yea

#

yea

#

yea

#

like this ?

#

if success and data then
tokens.Value = data.Tokens or 0
strength.Value = data.Strength or 0
player:SetAttribute("Strength", strength.Value)
money.Value = data.Money or 0

#

yess

#

ohhh

#

okay

#

i get it

#

i understand now

#

wdym

rough merlinBOT
#

studio** You are now Level 4! **studio

low kettle
#

oh

#

the premium one?

#

i already did it

#

and its working

#

local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")

local premiumGuiFolder = ServerStorage:WaitForChild("Premium")
local premiumScreenGui = premiumGuiFolder:WaitForChild("ScreenGui")

Players.PlayerAdded:Connect(function(player)
player:WaitForChild("leaderstats")
local strengthStat = player.leaderstats:FindFirstChild("Strength")

if player.MembershipType == Enum.MembershipType.Premium then
    local clonedGui = premiumScreenGui:Clone()
    clonedGui.Parent = player:WaitForChild("PlayerGui")

    if strengthStat then
        local previousValue = strengthStat.Value

        strengthStat:GetPropertyChangedSignal("Value"):Connect(function()
            local newValue = strengthStat.Value
            local difference = newValue - previousValue

            if difference > 0 then
                local boost = math.round(difference * 0.1)
                strengthStat.Value = previousValue + difference + boost
            end

            previousValue = strengthStat.Value
        end)
    end
end

end)

#

you can u se it