Accesories not becoming invisible and misplaced parts

ive been working on this script with a friend which basically just makes you a shape (thats put into server storage) when you touch a part. the problem with this is that 1: you also become invisible but the accesories dont become invisible for some reason and 2: the balls dont go on the player itself but behind them, (picture included below script)

Locations: part to touch is in workspace, inside that part is this script. and then in server storage theres a sphere called Sph

local Players = game:GetService("Players")
local TPDest = workspace.Washer
local cooldown = false
local cooldowntimer = 15 -- Change this to whatever you want the cooldown to be
local particletimer=2.1
local refreshtimer=1.5
local Particles= workspace.Wash.ParticleEmitter--path for your particles here
local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()

script.Parent.Touched:Connect(function(partTouched)
	if partTouched.Parent:FindFirstChild("Humanoid") and not cooldown then
        cooldown = true
		local Character = partTouched.Parent
		local Player = Players:GetPlayerFromCharacter(Character)
Particles.Enabled=true
delay(particletimer,function() Particles.Enabled=false end)
		delay(refreshtimer,function()
			        Player:LoadCharacter()
			Player.Character:WaitForChild("HumanoidRootPart").CFrame = TPDest.CFrame
			local char = plr.Character or plr.CharacterAdded:Wait()
			wait()
				for i,v in pairs(char:GetChildren()) do
				if v:IsA("MeshPart") or v:IsA("Part") then
					
					local new = game.ServerStorage.Sph:Clone() 
					if v.name == "HumanoidRootPart" then
						new:Destroy()
					else
					new.BrickColor = BrickColor.Random(math.randomseed)
					local weld = Instance.new("WeldConstraint", new)
					weld.Part0 = v
					weld.Part1 = new
						new.Parent = v
						v.Transparency = 1
					repeat new.Position = v.Position until new.Position == v.Position
					end
					end
			        if Player.Character:FindFirstChild("ForceField") then Player.Character:FindFirstChild("ForceField"):Destroy() end
			
				
			end
end)
        wait(cooldowntimer)
        cooldown = false
	end
end)

image

All accessory parts are usually parented to an “Accessory” instance, so I’d recommend either doing char:GetChildren() if v:IsA("Accessory") then v.Handle.Transparency = 1 or simply use char:GetDescendants() instead.

can you insert it into the script? i dont wanna mess the script up as it is very fragily

I’m currently on my phone, you just have to change this to for i, v in pairs(char:GetDescendants()) do

1 Like

that worked! now only we need to solve the parts going behind the player and not onto it.

For the part positioning, try using Welds instead of WeldConstraints,

and I’m not honestly sure what this line is for. afaik, when you create a weld (assuming both parts are unanchored), they’ll automatically get attached to Part0’s center.

so what do i change? (30 characters)

Change this

to local weld = Instance.new("Weld", new)

and remove this line

1 Like

worked! thanks! (30 characters)