helppppp plz why is it alaway using the old value?????
why the script is alaway using the old value of the string value?
2 answers
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
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 :(
2 comments
Edit your question.
what are you trying to do
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Show us the code...
Show the code so we can help
you forgot to show us the script?