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

Keydown arm color changing script not working? (PLEASE READ BELOW!)

Asked by
xVanc -1
7 years ago
Edited 7 years ago

in full detail, I am trying to switch the color to the color black, then with the same key switch back to the player's original skin color, but using the same key (q). do i use elseif or what?

PROBLEM:

there are two problems,

1, being: I'm trying to make a script where if you click a certain key it turns your arm black. if you click the same key you can revert to your original skin color. it doesn't seem to work when i use elseif? im new to this so if you could help i'd be glad. without this I can't continue problem 2.

2, being: in line 54, it says that there is no such thing as BrickColor, in the player in workspace. once you fix 1, this one is the next problem.

THIS IS A LOCALSCRIPT.

Player = game.Players.LocalPlayer
mouse = Player:GetMouse()

repeat wait() until Player.Character

local char = Player.Character
local torso = char:findFirstChild("Torso")
local leftarm = char:findFirstChild("Left Arm")

enabled = true

function onKeyDown(key)
    key = key:lower()
    if key == 'q' then
        local part = char["Left Arm"]:Clone()
        part.BrickColor = BrickColor.new("Institutional white")
        part.Material = "Neon"
        part.Name = "LeftArm2"
        part.CFrame = leftarm.CFrame
        part.Anchored = true
        part.CanCollide = false
        wait()
        part.Parent = char
        for i = 1, 10 do
            part.Size = part.Size +Vector3.new(0.1,0.1,0.1)
            part.Transparency = part.Transparency + 0.1
            part.CFrame = leftarm.CFrame
            wait()
        end
        part:destroy()
        torso.Anchored = true
        leftarm.BrickColor = BrickColor.new('Really black')
        leftarm.Material = 'Neon'
        leftarm.Reflectance = 0.1
        torso.Anchored = false
        end

    wait()
    elseif key =='q' then
        local part = char["Left Arm"]:Clone()
        part.BrickColor = BrickColor.new("Institutional white")
        part.Material = "Neon"
        part.Name = "LeftArm2"
        part.CFrame = leftarm.CFrame
        part.Anchored = true
        part.CanCollide = false
        wait()
        part.Parent = char
        for i = 1, 10 do
            part.Size = part.Size +Vector3.new(0.1,0.1,0.1)
            part.Transparency = part.Transparency + 0.1
            part.CFrame = leftarm.CFrame
            wait()
     leftarm.BrickColor = BrickColor.new(game.Workspace[Player.Name].BrickColor.Value)
        end
    end
end

enabled = false

mouse.KeyDown:connect(onKeyDown)

if you could help, i'd be thankful. thanks!

Answer this question