Help with cosmetics

  1. What do you want to achieve? Keep it simple and clear!
    I want to achive put 2 parts beside the player like this image when a event is fire, i already did that part of the event the only thing left its locating the parts but they spawn in 0,0,0 without spawning in the cframe i assigned for them, here what i want to achive :

  2. What is the issue? Include screenshots / videos if possible!
    As i said before the parts spawn in 0,0,0 and they do weld to the humanoidrootpart and play the sound but the position doesnt set to what i assigned, also i couldnt find help due to roblox ugc and it makes all the results roblox ugc.

  3. What solutions have you tried so far? Did you look for solutions on the Creator Hub?
    i tried using hrp.Scale but it didnt really work.

Heres my script soo far

local event = script.Parent:WaitForChild("Equip")

event.OnServerEvent:Connect(function(plr)
	local ss = game:GetService("ServerStorage")
	local folder = ss:WaitForChild("Cosmetics")
	local cosmetic = folder:WaitForChild("BeanosMain")
	
	local char = plr.Character or plr.CharacteAdded:Wait()
	local hrp = char:WaitForChild("HumanoidRootPart")
	
	local song = cosmetic:WaitForChild("BeanosSong")
	local b1 = cosmetic:WaitForChild("Beanos1")
	local b2 = cosmetic:WaitForChild("Beanos2")
	
	local b1_clone = b1:Clone()
	local b2_clone = b2:Clone()
	local songclone = song:Clone()
	local weld1 = Instance.new("WeldConstraint",b1_clone)
	local weld2 = Instance.new("WeldConstraint",b2_clone)
	
	songclone.Parent = hrp
	b1_clone.Parent = hrp
	b2_clone.Parent = hrp
	songclone:Play()
	b1_clone.CFrame = CFrame.new(hrp.CFrame.X/2,-hrp.CFrame.Y/2,0)
	weld1.Part0 = b1_clone
	weld1.Part1 = hrp
	b1_clone.Anchored = false
	b1_clone.CanCollide = false
	b1_clone.Massless = true
	
	b2_clone.CFrame = CFrame.new(-hrp.CFrame.X/2,-hrp.CFrame.Y/2,0)
	weld2.Part0 = b2_clone
	weld2.Part1 = hrp
	b2_clone.Anchored = false
	b2_clone.CanCollide = false
	b2_clone.Massless = true
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

If you want to offset the part relative to the player you can use the Directional Vector Components of CFrame

instead of CFrame.new(hrp.CFrame.X/2,-hrp.CFrame.Y/2,0)

if you want the part to offset 2 studs to the left of the player do the below

Solution
HRP.CFrame += HRP.CFrame.RightVector * -2

I’ve shared the link from the Roblox Documentation which shows a more in-depth explanation on Directional Vectors

Why don’t you try using CFrame.RightVector?

local rightCFrame = hrp.CFrame + (hrp.CFrame.RightVector * 2)
local leftCFrame = hrp.CFrame + (-hrp.CFrame.RightVector * 2)
1 Like

Why CFrame them at all?
Weld them both to the hrp using Part0 and Part1.
Offset them 2 studs to the right and left by setting each weld’s C0 or C1 property.
Set the CanCollide, Ancored, and Massless Properties on the b1 and b2 Parts before they are cloned so you don’t have to do it again every time.
Parent them to the hrp AFTER all the Welds and either the C0 or C1 have been set, otherwise they’ll appear at the wrong place and then teleport instantly from their 0,0,0 position in storage.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.