Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Would your value from your path change to something else? [ANSWERED]

Asked by
Scarious 243 Moderation Voter
9 years ago

What I mean is, would a Value from a path change in a line of code? So,

1local x = game.Workspace.BoolValue.Value
2x = true

would this change the path from game.Workspace.BoolValue.Value to true, so now if we try to print this,

1print(x)

would it print true from the path, or true from the value of x... as in would

1x = true

instead of

1x = game.Workspace.BoolValue.Value

So it doesn't changegame.Workspace.BoolValue.Value's value? Or would it? And it would keep the path instead of the value?


Answer:


Okay so, I just figured out how to check it, thanks to TurtleTowerz.

I added the following to Workspace:

BoolValue

Script

in ServerScriptService I put the following Script:

1local x = game.Workspace.Value.Value
2x = true
3print(game.Workspace.Value.Value)
4 
5local z = game.Workspace.Script.Disabled
6z = true
7print(game.Workspace.Script.Disabled)

In the end they both were, sadly, printed as false

As such, I conclude...

If you try to give the full path of something, and then change the Value of this path, the path itself will be destroyed, and replaced with the new Value.

Here was my full output:

1--[[
2Output:
3Hello world!
4false
5false
6]]

Sadly, this is the case.

~ Taryo

1 answer

Log in to vote
1
Answered by 9 years ago

No, it would use the newest given variable and the first variable would not be changed

An easy way to test this would be to use a scripts Disabledproperty as an example

1local x = script.Disabled
2x = true
3print(x)

The output is true

This proves that the Disabledproperty does not change, because it still prints out the phrase true

In a short sense, the code that you have provided will not change the BoolValue's Value to true.

I hope this helped!

0
Oops my bad, i read it wrong. Scarious 243 — 9y
0
However, the output would be true, but if you print script.Disabled and it was originally false, it will print false. Scarious 243 — 9y
Ad

Answer this question