#this is for a MaxedBeanChange
22 messages · Page 1 of 1 (latest)
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
k
and what is stopping
when i buy the Maxed Beans to increase the Beans Value it stops when i upgrade
stops what
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
well because it breaks probably
should i change the break to something else
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
yes