Ad
Log in to vote
0

Is there any reason for why my script (that randomizes things) is not doing anything?

Asked by 4 days ago

I'm trying to make a script that randomized the player's face, and torso color. (also a 1/10 chance it becomes something different), but it's doing nothing. It isn't even printing chance.

(it's a script inside my StarterPlayer model)

wait(1)

local faces = {"18151826", "15432080", "14861743", "15471035", "16132514", "406000730", "15177601", "15637848", "7317773", "376813144", "14817393"}
local chance
chance = math.random(1,10)
print(chance)

script.Parent.Head.face.Texture = "rbxassetid://"..faces[math.random(1, #faces)]
script.Parent.Torso.BrickColor = BrickColor.Random()

if chance == 3 then
    script.Parent.face.Texture = "rbxassetid://5607058200"
    script.Parent.Torso.BrickColor = BrickColor.new("Institutional White")
    for i,v in pairs(game.ServerStorage:GetChildren()) do
        local v2 = v:Clone()
        v2.Parent = script.Parent.Torso
    end
end

Does anyone know why this script is doing nothing?

1 answer

Log in to vote
0
Answered by 4 days ago

I am not experienced with these things, and I really do not put my scripts in Starter-Player, but I'll try to give you my answer to this script. This is also a bit more complicated than I am used to. Line 3 is fine. Lines 4-6 have an error. Firstly, I'm pretty sure you do note even need to do

chance = math.random(1,10)

You already started your variable, you defined a variable within itself.

Ad

Answer this question