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

This script that changes the face of a certain player doesn't work but has no errors?

Asked by
608b 4
4 years ago
local players = "88559361"

  for i = 1, #players do
   if players[i] == plr.UserId then
    gear:Clone().Parent = plr:WaitForChild("Backpack")
    gear2:Clone().Parent = plr:WaitForChild("Backpack")
        local Head = chr:WaitForChild("Head")
                 for i, head in pairs (Head:GetChildren()) do
            if head:IsA("Decal") then
                print("FaceFound")
                print(head.Texture)
                if plr.UserId == players then
                    Head.Face.Texture = 'rbxassetid://478890416'
                end
            end
        end
   end
  end
 end)
end)

it has no errors but it doesn't change the face?

0
change the variable players to hold table values so local players = {88559361,} and see if anything changes. deth836231 142 — 4y

1 answer

Log in to vote
3
Answered by
appxritixn 2235 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

First off, I don't understand why you are checking the length of the string. Right now, you are comparing each digit of the stored id with the player's entire userid. I would change your players variable to a table.

Also, please format your code properly. It helps the person answering your question out a lot.

local players = {88559361}

for i,v in pairs(players) do
    if v == plr.UserId then
        gear:Clone().Parent = plr:WaitForChild("Backpack")
        gear2:Clone().Parent = plr:WaitForChild("Backpack")
        local Head = chr:WaitForChild("Head")
        for x,y in pairs (Head:GetChildren()) do
            if y:IsA("Decal") then
                print("FaceFound")
                print(y.Texture)
                if plr.UserId == players then
                    Head.Face.Texture = 'rbxassetid://478890416'
                end
            end
        end
    end
end
0
I tested this and it did the correct thing but I had already fixed it but thanks!! 608b 4 — 4y
Ad

Answer this question