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

I'm new to scripting, this is my first time using char and nothing works with it just wanna know?

Asked by 5 years ago
script.Parent.Activated:Connect(function()
    if canForm == true then
    local form = Instance.new("ParticleEmitter")
    form.Texture = "http://www.roblox.com/asset/?id=709137722"
    form.Size = 2
    form.Color = Color3.new(116,81,58)
    wait(0.6)
    canForm = false
    form:Destroy()
    char:FindFirstChild("RightArm").Material = "Corroded Metal"
    char:FindFirstChild("Shirt"):Destroy()
    end
end)

0
theres variables above this but this is just the main function iiOderCopx 0 — 5y
0
What are the variables? NeonNikilis 5 — 5y
0
canForm is set to true, players is set to localplayer, char is obviously set to character iiOderCopx 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

This is because in the R6 rig of the character, the right arm is called Right Arm, not RightArm. The material is Enum.Material.CorrodedMetal, not "Corroded Metal" with a space. There were a few things you did wrong as well, like using Color3.new without dividing each number by 255.

script.Parent.Activated:Connect(function()
    if canForm then -- no need for == true'
        local form = Instance.new("ParticleEmitter")
        form.Texture = "http://www.roblox.com/asset/?id=709137722"
        form.Size = 2
        form.Color = Color3.new(116/255,81/255,58/255)
        form.Parent = script.Parent.Handle
            -- Assuming this is a tool, I put it in the handle 
        wait(0.6)
        canForm = false
        form:Destroy()
        local ra = char:FindFirstChild("Right Arm")

        if ra then
            ra.Material = Enum.Material.CorrodedMetal
        end

        local shirt = char:FindFirstChild("Shirt")

        if shirt then 
            shirt:Destroy()
        end
    end
end)


You should also be checking if objects exists via if statements, as code won't work if the object doesn't exist.

Ad

Answer this question