Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

3 comments

0

Show us the code...

0

Show the code so we can help

0

you forgot to show us the script?

2 answers

✓ Accepted answer

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

1

Edit your question.

0

what are you trying to do

This discussion is preserved as it was. New answers, comments, and votes are closed.