Cape Physics (Script Issue)

  1. okay so, i have a cape that works like realistic cloth, it works perfectly fine when its in the workspace, and the script is set to game:GetService(‘Workspace’).StarterCharacter.HumanoidRootPart.Cloth I load into the game the cape works perfectly, HOWEVER!!! When I put the Startercharacter model into StarterPlayer to PLAY as the character with the cape on, It completely breaks, even when I change game:GetService(‘Workspace’) to (‘StarterPlayer’)

this is the cape in starterplayer (inside the startercharacter model), this is the broken one I’ve spent all day trying to fix and im still lost!
image|690x319

(What its supposed to do, but only works when the model is in workspace)

Help!!

i see that ClothSimulation script thingy, can you show it

Here’s the script inside that;

local cloth = game:GetService(‘Workspace’).StarterCharacter.HumanoidRootPart.Cloth
–local plane = cloth:WaitForChild(‘Handle’)
repeat task.wait(0.1) until game:IsLoaded() == true

local bones = {}
local groupsAmount = #cloth:GetChildren()

for count = 1, groupsAmount do
bones[count] = {}
end

local debugMode = false

function bone(bone)
local physPart = Instance.new(‘Part’)
local a = 0.4
physPart.Size = Vector3.new(a,a,a)
–physPart.Shape = Enum.PartType.Ball
physPart.Position = bone.WorldPosition
physPart.Anchored = false
physPart.Color = Color3.new(1, 0, 0)
physPart.Parent = game:GetService(‘Workspace’).StarterCharacter.HumanoidRootPart.Physics
if debugMode == false then
physPart.Transparency = 1
end

local att = Instance.new('Attachment', physPart)
att.Name = 'Att'

local info = string.split(bone.Name, '.')
local group = tonumber(info[2])
local index = tonumber(info[3])

bones[group][index] = {physPart, bone}

physPart.Name = bone.Name

end

for i, v in pairs(cloth:GetDescendants()) do
if v:IsA(‘Bone’) then
bone(v)
end
end
local rows = {}
for count = 1, #cloth:GetChildren() do
rows[count] = {}
end

for i, v in pairs(bones) do --// physPart, bone
for d, b in pairs(v) do
if d ~= 1 then
local rope = Instance.new(‘RopeConstraint’, game:GetService(‘Workspace’).StarterCharacter.HumanoidRootPart.Physics)
rope.Attachment0 = v[d-1][1].Att
rope.Attachment1 = b[1].Att
rope.Name = rope.Attachment0.Parent.Name…rope.Attachment1.Parent.Name
rope.Visible = debugMode
rope.Color = BrickColor.new(‘Really blue’)
rope.Length = (v[d-1][1].Position-b[1].Position).Magnitude
else
b[1].Anchored = true
end
table.insert(rows[d], b[1])
end
end
for i, v in pairs(rows) do
for ii, b in pairs(v) do
if ii ~= 1 then
local rope = Instance.new(‘RopeConstraint’, game:GetService(‘Workspace’).StarterCharacter.HumanoidRootPart.Physics)
rope.Attachment0 = b.Att
rope.Attachment1 = rows[i][ii-1].Att
rope.Name = rope.Attachment0.Parent.Name…rope.Attachment1.Parent.Name
rope.Visible = debugMode
rope.Color = BrickColor.new(‘Really blue’)
rope.Length = (b.Position-rows[i][ii-1].Position).Magnitude
end
end
end

local plr = game:GetService(‘Players’).LocalPlayer
game:GetService(‘RunService’).Heartbeat:Connect(function()
for i, v in pairs(bones) do
for i, b in pairs(v) do
b[2].WorldPosition = b[1].Position
end
end

local plr = game.Players.LocalPlayer

--[[if plr and plr.Character and plr.Character:FindFirstChild('HumanoidRootPart') then
	cloth.Handle.CFrame = plr.Character.HumanoidRootPart.CFrame
	for i, v in pairs(plr.Character:GetChildren()) do
		if v:IsA('BasePart') then
			v.CanCollide = false
		end
	end
end
--]]

end)
–[[
local rope = Instance.new(‘RopeConstraint’, cloth.Physics)
rope.Attachment0 = trgPart
rope.Attachment1 = bones[iii][ii][1].Att
rope.Name = rope.Attachment0.Parent.Name…rope.Attachment1.Parent.Name
rope.Visible = true
rope.Color = BrickColor.new(‘Really blue’)
rope.Length = (trgPart.Parent.Position-bones[iii][ii][1].Position).Magnitude
]]

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)

	local torso = char:WaitForChild("HumanoidRootPart") --You can change this to another body part

	local newPart = Instance.new("Part", char)
	newPart.Massless = true --You will likely want to set at least these properties
	newPart.CanCollide = false
	newPart.Anchored = false

	local weld = Instance.new("Weld", torso) --Could also use a Motor6D, or likewise
	weld.C0 = CFrame.new() --Both C0 and C1 are, by default, set to a blank CFrame
	weld.C1 = CFrame.new()
	weld.Part0 = torso
	weld.Part1 = newPart

end)

end)

sorry idk how to get the text in a small box