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

"Torso is not a valid member" r15?

AttachBand = script.Parent
Storage = game:GetService("ServerStorage")
Market = game:GetService("MarketplaceService")
Data = game:GetService("DataStoreService"):GetGlobalDataStore("Db")
BandsPassID = passid
fade_bands = true

Positions = {
	["Left Arm 1"] = CFrame.new(0,-0.5,0),
	["Left Arm 2"] = CFrame.new(0,0,0),
	["Left Arm 3"] = CFrame.new(0,0.5,0),

	["Right Arm 1"] = CFrame.new(0,-0.5,0),
	["Right Arm 2"] = CFrame.new(0,0,0),
	["Right Arm 3"] = CFrame.new(0,0.5,0),

	["Left Leg 1"] = CFrame.new(0,-0.5,0),
	["Left Leg 2"] = CFrame.new(0,0,0),
	["Left Leg 3"] = CFrame.new(0,0.5,0),

	["Right Leg 1"] = CFrame.new(0,-0.5,0),
	["Right Leg 2"] = CFrame.new(0,0,0),
	["Right Leg 3"] = CFrame.new(0,0.5,0)
}

Positions_v2 = {
	["Left Arm 1"] = CFrame.new(-0.225,-0.5,0),
	["Left Arm 2"] = CFrame.new(-0.15,0,0),
	["Left Arm 3"] = CFrame.new(-0.11,0.5,0),

	["Right Arm 1"] = CFrame.new(0.225,-0.5,0),
	["Right Arm 2"] = CFrame.new(0.15,0,0),
	["Right Arm 3"] = CFrame.new(0.11,0.5,0),

	["Left Leg 1"] = CFrame.new(0,-0.5,0),
	["Left Leg 2"] = CFrame.new(0,0,0),
	["Left Leg 3"] = CFrame.new(0,0.5,0),

	["Right Leg 1"] = CFrame.new(0,-0.5,0),
	["Right Leg 2"] = CFrame.new(0,0,0),
	["Right Leg 3"] = CFrame.new(0,0.5,0)	
}

function checkPackage(char,part)
	part = tostring(part) 
	local pkg
	for i,v in ipairs(char:GetChildren()) do
		if v:IsA("CharacterMesh") and (part and part:lower():find(v.BodyPart.Name:lower())) then pkg = true break end
	end
	return pkg
end

AttachBand.Event:connect(function(char,location,color,keep)
	local band,package = Storage:WaitForChild("GlowWristBand"):Clone(),false

	if char.Torso:FindFirstChild(location) then
		char.Torso[location]:Remove()
	end
	if color == nil then color = BrickColor.new(Color3.fromHSV((math.random(0,36)*10)/360,1,1)) end
	if checkPackage(char,location) then
		band = Storage:WaitForChild("GlowWristBandv2"):Clone()
		package = true
	end
	if fade_bands then band.Transparency = 1 end
	band.BrickColor = type(color) == "string" and BrickColor.new(color) or color
	band.Parent = char.Torso
	band.Name = location

	local weld = Instance.new("Weld",char.Torso)
	weld.Name = "BandWeld"
	weld.Part0 = char[location:sub(1,-3)]
	weld.Part1 = band

	weld.C1 = package and Positions_v2[location] or Positions[location]
	weld.C1 = weld.C1		-- * CFrame.new(1.6*(rot/15),0,0) * CFrame.Angles(0,0,math.rad(15*(rot/15)))
	band.Anchored = false
	
	if fade_bands then
		coroutine.resume(coroutine.create(function() band.Transparency = 1 for t=1,0,-0.05 do band.Transparency = t wait(1/20) end end))
	end
end)

AttachBand.Local.OnServerEvent:connect(function(plr,...)
	AttachBand:Fire(plr.Character,...)
end)

function AttachBand.SetBands.OnServerInvoke(plr,location,color)
	if Market:PlayerOwnsAsset(plr,BandsPassID) and plr.Character then
		workspace.AttachBand:Fire(plr.Character,location,color)
	else
		Data:SetAsync(plr.userId.."_WristBands",{Location = location, Color = color})
		wait(0.5)
		Market:PromptProductPurchase(plr,gamepass)
	end
end


Im struggling to convert this code to r15 format for Torso. Help would be appreciated!

3 comments

0

line 56 is where it says its not find it in the error?

0

ye

0

R6 has 1 torso name "Torso", and r15 has 2 torso peices, "LowerTorso" and "UpperTorso",

1 answer

As A_Mp5 said, with r15 there is no part named torso there are two parts "LowerTorso" and "UpperTorso". I think if you're using the torso to reference the position of the player/Humanoid use HumanoidRootPart.

4 comments

0

so my code would be char.HumanoidRootPart?

0

if you are just using torso as a means of getting the players position then yes use char.HumanoidRootPart

0

Hm im struggling

0

Same I Would Use This

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