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

Why is this not working?

Asked by 10 years ago

This script I have is not working like there is no error and nothing happens? Script:

face1 = "http://www.roblox.com/asset/?id=162384466"
face2 = "http://www.roblox.com/asset/?id=162387197"
face3 = "http://www.roblox.com/asset/?id=162387541"
faces = {face1,face2,face3}
h = script.Parent.Parent.Character.Head
hft = h.face.Texture
game.Players.PlayerAdded:connect(function()
while true do
wait(5)
rm = math.random(1, #faces)
if rm == face1 then
    htf = face1
end
if rm == face2 then
    htf = face2
end
if rm == face3 then
    htf = face3
end
end
end)

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

I think that would work, but here's what I would do:

local faces = {
"http://www.roblox.com/asset/?id=162384466",
"http://www.roblox.com/asset/?id=162387197",
"http://www.roblox.com/asset/?id=162387541" }

game.Players.PlayerAdded:connect(function(plr)
    while true do
        wait(5)
        player.Character.Head.face.Texture = faces[math.random(1,#faces)
    end
end)

Just cleans it up a bit.

Ad

Answer this question