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

Ways to convert a player value into an object value?

Asked by 7 years ago
plr = game.Players.LocalPlayer
player = workspace:WaitForChild(plr)

In the above the output says it cant find player. Is there a way to convert the player value in plr into an object value in player.

3
A Player Value is already a object value. If you're trying to get the character, why the heck don't you just use plr.Character? M39a9am3R 3210 — 7y
0
the problem is you are missing a big piece "Character", plr = game.Players.LocalPlayer.Character scottmike0 40 — 7y

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago

I'm not entirely sure what you're asking but I can explain why your code doesn't work.

Your code doesn't function because 'plr' is the actual Player object. The WaitForChild function takes in strings, not objects. You probably got an error like:

Infinite yield possible on 'workspace:WaitForChild("Instance")'

If the WaitForChild function causes the script to yield for 5 seconds, it will return this error.

0
I already understand that shabbs15 67 — 7y
Ad

Answer this question