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.
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.