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

why the script is alaway using the old value of the string value?

Asked by 5 years ago

helppppp plz why is it alaway using the old value?????

0
Show us the code... OfcPedroo 396 — 5y
0
Show the code so we can help Leamir 3138 — 5y
0
you forgot to show us the script? vanilla_wizard 336 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Here's the deal kid, the value you need to store is through Value.Changed:Wait()

The fact is you don't need a while loop to loop non-stop throughout a player's entire game just to record new values. Also in case you haven't figured it out boy, Strings in Lua are immutable values.

Let me give you an example:

alphabet_A = "A" -- STRING #1

alphabet_B = "B" -- STRING #2

print(alphabet_A..alphabet_B) -- STRING #3

This example shows how the individual strings aren't set to a new value and, instead, Lua creates a new string distinguishable from the prior two. In other words individual strings cannot be manipulated, only formatted and manipulated through the String Library. Anything else will simply return a new string on its own, and there is yet to mention that print calls a tostring() function before prompting to the standard output panel.

In your special case, we must call the Roblox provided; Value.Changed:Wait() signal on any of the cast Value Objects available in the instance library. Good luck and let me know when you figure out the rest. ;p

Ad
Log in to vote
0
Answered by 5 years ago
while wait() do
    print(script.Parent.plr.Value)
    if game.Players:FindFirstChild(script.Parent.plr.Value) then
        if game.Players:FindFirstChild(script.Parent.plr.Value).Character:FindFirstChild("Humanoid") then
            script.Parent:Sit(game.Players:FindFirstChild(script.Parent.plr.Value).Character:FindFirstChild("Humanoid"))
        end
    end
end

when i change the string value nothing happen :(

1
Edit your question. TheeDeathCaster 2368 — 5y
0
what are you trying to do vanilla_wizard 336 — 5y

Answer this question