#Why is it when I trigger the proximityprompt, it changes the "stringMutationValue" value? [SOLVED]

1 messages · Page 1 of 1 (latest)

heady spindle
#

Can you just paste your issue here instead? Accessing that link on mobile says its private or doesn't exist

fiery spruce
#

like this? also the issue is that it changes value without me even doing anything

#

but triggering a proximity

#
    prox.Triggered:Connect(function(plr)
        print(stringMutationValue.Value.." Line 416")
hollow sorrelBOT
#

studio** You are now Level 1! **studio

heady spindle
fiery spruce
#

this problem came out of the blue

heady spindle
#

Uh so all of this code has multiple places where it changes the value

I think I need more context

vagrant garden
#

Horrific

fiery spruce
#

stringMutationValue doesnt change tho

#

is it this?

#

Why is it when I trigger the proximityprompt, it changes the "stringMutationValue" value?

fiery spruce
hollow sorrelBOT
#

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

hot sinew
#

it'd be easier to see the full script

#

show pastebin

fiery spruce
hot sinew
#
    task.spawn(function()
        while task.wait() do
            local randomMythic=SodaTable[RNG:NextInteger(0, #SodaTable)]
            for i, v in pairs(mutationTable) do
                weight2-=mutationTable[i][2]
                if chosen2>weight2 then
                    stringMutationValue.Value=mutationTable[i][1]    
                    break
                end
            end```
fiery spruce
#

it wasnt a problem before but its a problem now

hot sinew
#

there's yer problem fingerguns

fiery spruce
#

doesnt the top one matter?

hot sinew
#

idk this code is really bad

fiery spruce
#

i just do things the simple and complicated way man

hot sinew
#

ye this is the point where s1 beginner patterns fail

fiery spruce
#

s1?

hot sinew
#

scripter ranking ;o

#

you share this instance value throughout your code and change it in all sorts of places for different reasons between yields and whatnot local stringMutationValue=sodamodel:WaitForChild("MutationValue")

#

it is bound to fail because of this

#
task.spawn(function()
    while task.wait(3) do
        chanceSystem()
    end
end)```
fiery spruce
#

every time i do that it automatically puts me to like another area

#

of the entire script

#

when i press enter

fiery spruce
#

@hot sinew i took your "nest your code" thing and it somehow worked and made tweaks in my other script

#

and just removed the entire "stringmutationvalue" thing

#

also made the script a modulescript for some reason but still works

#

nevermind i lied it does the same thing

fiery spruce
#

scratch everything i just said again

hot sinew
fiery spruce
#

i mean as long as it works right lol

hot sinew
#

because in your case

#

it doesn't work now does it?

fiery spruce
#

it works now