Hello, I need help fixing my early access badge. It’s getting stuck in the middle and I can’t get it to go on the players front side left top corner of UpperTorso.
-- Get the player's character and the EA model
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
-- Check if EA exists in ReplicatedStorage
local eaModel = game.ReplicatedStorage:FindFirstChild("EA")
if not eaModel then
warn("EA model not found in ReplicatedStorage!")
return
end
-- Wait for the character's humanoid and torso to load
local humanoid = character:WaitForChild("Humanoid")
local torso = character:WaitForChild("UpperTorso") -- or "Torso" for older avatars
-- Clone the EA model to the Workspace (instead of leaving it in ReplicatedStorage)
local eaClone = eaModel:Clone()
eaClone.Parent = workspace -- Make sure it's in Workspace to be visible to all players
-- Ensure the EA model has a PrimaryPart set
if not eaClone:FindFirstChild("PrimaryPart") then
-- Find any part-like object in the model to use as the PrimaryPart
local part = eaClone:FindFirstChildOfClass("Part") or eaClone:FindFirstChildOfClass("MeshPart") or eaClone:FindFirstChildOfClass("UnionOperation")
if part then
eaClone.PrimaryPart = part
else
warn("No suitable parts or MeshParts found in EA model!")
return
end
end
-- Store the initial position offsets of each part relative to the PrimaryPart
local partOffsets = {}
for _, part in pairs(eaClone:GetDescendants()) do
if part:IsA("Part") or part:IsA("MeshPart") or part:IsA("UnionOperation") then
-- Calculate the relative position offset of each part from the PrimaryPart
local offset = part.Position - eaClone.PrimaryPart.Position
partOffsets[part] = offset
-- Create a WeldConstraint to attach each part to the torso
local weld = Instance.new("WeldConstraint")
weld.Parent = part
weld.Part0 = part
weld.Part1 = torso
end
end
-- Set the PrimaryPart's position directly on the player's chest
-- Adjust to a smaller LookVector multiplier and Y offset for correct chest positioning
eaClone.PrimaryPart.Position = torso.Position + torso.CFrame.LookVector * 0.5 + Vector3.new(0, 0.5, 0) -- Adjust the multiplier (0.5) and Y offset
-- Update each part's position to maintain their original offsets
for part, offset in pairs(partOffsets) do
part.Position = eaClone.PrimaryPart.Position + offset
end
This is what it looks like.
Thank you, for your help!
– Dylan
