#bag can hold amount of food but when bag maximum increase the food stay the same as old bag

54 messages · Page 1 of 1 (latest)

bold acorn
#

Any help ?

teal flicker
#

awha

#

how are you storing the food

#

@bold acorn

bold acorn
#

?

teal flicker
bold acorn
#
local foods = game.Workspace.Food
for i , food in foods:GetChildren() do 
    local debounce = false
    local maxvalue = game.ReplicatedStorage.maxvalue.Value
    food.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
            local player = game.Players:GetPlayerFromCharacter(hit.Parent)
            if player and debounce == false then
                local Food = player.leaderstats.Food
                if Food.Value < maxvalue then
                    debounce = true
                    Food.Value += 1
                    food.Position = Vector3.new(math.random( -28 , 29), 10 , math.random( -28 , 28))
                    wait(0.5)
                    debounce = false
                end

            end
        end
    end)
end
#

this give me food

teal flicker
#

?

bold acorn
#

can u come on genral bec i want to open live

#

to show u

teal flicker
#

just paste the scripts

#

i dont got enough data for that

bold acorn
#

no i want to show u something

#

oh ok wait

#

i do intvalue named maxvalue on replicated storge

#

it is begain with 10

teal flicker
#

yep

bold acorn
#

10*

#
local changebag = script.Parent
local maxBag = game.ReplicatedStorage.maxvalue
changebag.MouseButton1Click:Connect(function()
    maxBag.Value = 15
end)
#

and here button if i pressed on it

teal flicker
#

mhm

#

so whats the problem

bold acorn
#

the bag change value amount of food must be <15 and stoped but

#

it still <10

teal flicker
#

oh

#

so the first script is a server script and the second one a local?

#

u gotta send a remote event to the server

#

and change it from there

bold acorn
#

oh i know how to do

#

but why ?

teal flicker
#

changing it on the client like that doesn't change it on the server

bold acorn
#

u me onclint

#

mean

teal flicker
#

you're changing the max value on the client

#

but for security reasons and because nothing gets automatically replicated from client to server, only the other way around, the server doesn't see that change

bold acorn
#

i need to open live to see i do remote control wrong or no

teal flicker
#

or if you don't want to get into that, another solution is just changing your 2nd script to a server script @bold acorn

bold acorn
#

server ?/

teal flicker
#

it probably has some weird side effects but I don't think you're worried about that

bold acorn
#

why

teal flicker
bold acorn
#

if i change from local to normal script that will mean server all will affect

bold acorn
#

i know how to use remote event but where i use it

#

normal script not work also XD

teal flicker
#

wdym?

#

oh

#

huh

#

idk

bold acorn
#

can u see live only

#

to fix all things

#

just min