Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I concatenate this?

I need to concatenate the parts name to "Clone_" but I can't because I keep getting a error in the output.How would I concatenate this?If you manged to fix please show how and what you did.

Output:

Workspace.Script:16: attempt to concatenate local 'v' (a userdata value)

game.Players.PlayerAdded:connect(function(Player)
        Player.CharacterAdded:connect(function(Character)
---------------------------------------------------------
            function MakeDisplayArms()
---------------------------------------------------------
                local CurrentCamera = game.Workspace.CurrentCamera
                local PlayerArms = {
                    Character["Right Arm"],
                    Character["Left Arm"]}
---------------------------------------------------------
                    for i,v in pairs (PlayerArms) do
FoundClonedArms = CurrentCamera:FindFirstChild("Cloned_"..v.Name)--Finds for Cloned parts
                if not FoundClonedArms then--Litte debounce
                        local ClonedArms = v:Clone()
                        ClonedArms.Parent = CurrentCamera--Hides it from everyone else
                        ClonedArms.Name = "Cloned_"..v --Renames it
                        ClonedArms.CanCollide = false
                        local Weld = Instance.new("Weld")
                            Weld.Part0 = v--Welds it Arms
                            Weld.Part1 = ClonedArms
                        return ClonedArms
                        else
                    return FoundClonedArms
                    end
                end
            end
---------------------------------------------------------           
            MakeDisplayArms()
        end)
end)


What is this script suppose to do? This script is suppose to make a fake arm that is hidden in the CurrentCamera and that the player can see his arm when zoomed in.

2 comments

0

Look at line 16.

0

Oh my bad

1 answer

✓ Accepted answer

v, as the error says is a userdata object (that just means its a ROBLOX object of some kind - an Instance, a CFrame, a BrickColor).

You can't actually concatenate those, since they aren't strings. Since they are ROBLOX instances, you are probably intending to use the objects Name, so just explicitly use that:

"Clone_" .. v.Name

This works since the Name property is a string.

2 comments

0

I changed it to the name property and I still got the same error.

0

Look at line 16.

This discussion is preserved as it was. New answers, comments, and votes are closed.