#this is for a MaxedBeanChange

22 messages · Page 1 of 1 (latest)

coral flower
#

that is for the data store

#
local ReplicatedStorage=game.ReplicatedStorage.Beans
ReplicatedStorage.OnServerEvent:Connect(function(plr,v)
    local Beans=plr.leaderstats.Beans
    local Max=plr.Stats.MaxedBeans
    Beans.Value=0
    Max.Value+=v
end)```for server side
#
local MaxedBeans=script.Parent.Frame
local ReplicatedStorage=game.ReplicatedStorage.Beans
local Player=game:GetService('Players').LocalPlayer
local Beans=Player:WaitForChild('leaderstats'):WaitForChild('Beans')
local Maxed=Player:WaitForChild('Stats'):WaitForChild('MaxedBeans')
for i,v in pairs(MaxedBeans:GetChildren()) do
    if v:IsA('TextButton') then
        v.MouseButton1Click:Connect(function()
            if Beans.Value>=v.Cash.Value then
                Beans.Value-=v.Cash.Value
                Maxed.Value+=v.MaxedBeans.Value
                local amount=tonumber(v.Name)
                ReplicatedStorage:FireServer(amount)
            end
        end)
    end
end```and this is for the change Value to the textbutton
#

its stopping when i upgrade the MaxedBeans

sharp crag
#

dude

#

you're allowed to use whitespace

#

you*don't=have-to/code=like+this

coral flower
#

k

sharp crag
#

and what is stopping

coral flower
#

when i buy the Maxed Beans to increase the Beans Value it stops when i upgrade

sharp crag
#

stops what

coral flower
#

the lua local function giveCurrency(player) while true do task.wait(2) player.leaderstats.Beans.Value+=2 if player.leaderstats.Beans.Value>=player.Stats.MaxedBeans.Value then break end end endit stops this loop

sharp crag
#

well because it breaks probably

coral flower
#

should i change the break to something else

sharp crag
#

I have no idea what you even intend to do

#

but you're telling it to stop

coral flower
#

what im trying to do is when player upgrades the MaxedBeans the Beans are set to the MaxedBeans

#

then the Beans stop at the Value of Maxed Beans

coral flower
sharp crag
#

dude

#

you can just do Beans = MaxedBeans

#

why are you using a loop