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

why my script is alaway using the old value?

hi, my script is alaway using old value but idk why it's alaway print "" even when i change the value of the string value

while true do
	game:GetService("RunService").Stepped:wait()
	plr = game.Players:FindFirstChild(script.Parent.plr.Value)
	print(script.Parent.plr.Value)
	if game.Players:FindFirstChild(script.Parent.plr.Value) then
		if plr.Character ~= null then
			script.Parent:Sit(plr.Character.Humanoid)
		end
	end
end

1 answer

This might be a solution.

while true do
    wait(1)
    game:GetService("RunService").Stepped:wait()
    plr = game.Players:FindFirstChild(script.Parent.plr.Value)
    print(script.Parent.plr.Value)
    if game.Players:FindFirstChild(script.Parent.plr.Value) then
        if plr.Character ~= nil then
            script.Parent:Sit(plr.Character.Humanoid)
        end
    end
end

You wrote null instead of nil. You also need a wait otherwise it can crash the whole server. This should work now but comment if it does not. This is all i can think of. Hope this helps!

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