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

How do I make this variable work correctly? Putting a number manually works.

Asked by 1 year ago

Hello. I have been trying to make a script clear your accessories and then load in your current roblox avatar accessories.


local player = game.Players:FindFirstChild(username) local playeruserid = player.UserId print(playeruserid) print(type(playeruserid)) clearAccessories(character) -- This is working like it should. Don't mind the "character" variable. wait(0.5) character.Humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(playeruserid))

The issue is the last line of the code not running correctly. If I replace the "playeruserid" variable with a userid manually, such as "1081709372" the script works fine. I can't figure out why, because using the two prints I can see that I get a correct userid in the variable and it is of the number type.

It should be the same as if I put it in manually, considering it's an ID in the number type? I did try running the tonumber function prior to putting it in without success.

0
It just realized it is working with other userIDs but it isn't working with my own. Very strange. Found this out by manually putting my own ID into the script. Any other ID I have tried works just fine. tim458458 29 — 1y
0
Where is this script located? If you clone it in the players inventory from the server and you never disable it and it runs on the server then it will not get an id because the server doesn't have one. HeroFigo 81 — 1y
0
It's in serverscriptservice. It is able to grab the ID correctly, seeing as the line "print(playeruserid" always returns a correct id. Something goes wrong with applying everything. tim458458 29 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago

Solved. Refer to this article for the issue:

https://devforum.roblox.com/t/humanoidapplydescription-not-working-as-intended/931846

Ad

Answer this question