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

I know this is prob a dumb question but why am i getting this error?

Torso is not a valid member of Script

wait(5)
if game.Workspace.Abrobot.Torso.Velocity.magnitude > 0 then 
	print(324) end

15 comments

0

First do :FindFirstChild("Torso").

0

i will try

0

it did not work maybe i don't understand what you mean sorry i new at the scripting things

0

If your name isn't Capitalized in game then don't Capitalize it in the script, all Coding is Caps Sensitive. Try game.Workspace:WaitForChild("abrobot").Torso.Velocity.magnitude

0

Infinite yield possible on 'Workspace:WaitForChild("abrobot")'

0

try local abrobot = game.Workspace:WaitForChild("abrobot"), if abrobot.Torso.Velocity.magnitude > 0 then print(324) else print("Velocity.magnitude Is not greater than 0") end

0

oh do you know why there is a -5 by my name

0

thx for all your help im just starting to try to script and im not that good i appreciate your help

0

oh it did not work

0

Np, It's in the negatives if someone down votes your thread or answer, it takes away a certain amount of points even if you started with 0.

0

Can you show more of the script because i can't really help any more than that if i can't see what might be interfering.

0

thats it thats all the script

0

see im trying to test something and i want my guy to be anchored when his velocity is at 0 after he jumps

0

Well to do that it's a lot more complex, Velocity won't detect if Player is jumping. You would need to use UserInputService and you would need to learn a lot more Roblox Lua to be decent at at least trying to figure out how to do it. Later today i can try to help you.

0

kenUSM thx for your help and im getting off now but i will be on tomorrow and i sent you a friend request on roblox but itis still Infinite yield possible on 'Players:WaitForChild("abrobot")'

1 answer

✓ Accepted answer

Not sure what you're trying to accomplish here, if your character is R6 then torso should work, if it is R15 though you're going to want to search for "UpperTorso" or "LowerTorso"


--Lets grab the players from the game
players = game:GetService("Players")

--Wait for abrobot in the game's players
player = players:WaitForChild("abrobot")

--Grab the players character from the player
character = player.Character

--Grab the torso from the character
torso = character:FindFirstChild("Torso")

--Check velocity and print if its above 0
if torso.Velocity.magnitude > 0 then
	print(324)
end

7 comments

0

um im trying to test something and im using r6

0

Oops, put it all in a block quote on accident, you should be able to copy what I provided and it should print out when needed

0

still Infinite yield possible on 'Players:WaitForChild("abrobot")'

0

Depends on where you are testing it at, try changing abrobot to Player1, if you arent logged in on Studio it will default to Player1 as the player name

0

Use your Roblox Name exactly how it is. If it is Abrobot or abrobot. If you don't it won't detect it and it will throw that error.

0

i really appreciate you guys helping me out

0

If my answer was what you needed, accept it so the question appears answered any nobody else posts one

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