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.