ldaspp
(ldaspp)
April 28, 2024, 12:08pm
#1
You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to have a function to put a model on a player’s back
What is the issue? Include screenshots / videos if possible!
All my aproaches have not worked
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried cframe, but that ended up glitching the item badly
Lauri9
(Lauri9)
April 28, 2024, 12:19pm
#2
Have you tried using a weld to attach the model on the players back?
Simple example:
game.Players.PlayerAdded:Connect(function(Player: Player)
Player.CharacterAppearanceLoaded:Connect(function(Character)
local NewPart = script.Part:Clone()
NewPart.Massless = true -- To make sure it won't affect movements
local UpperTorso: BasePart = Character:FindFirstChild("UpperTorso")
NewPart.CFrame = UpperTorso.CFrame:ToWorldSpace(CFrame.new(0,0,(UpperTorso.Size.Z + NewPart.Size.Z)/2))
local WeldConstraint = Instance.new("WeldConstraint")
WeldConstraint.Part0 = UpperTorso
WeldConstraint.Part1 = NewPart
WeldConstraint.Parent = NewPart
NewPart.Parent = Character
end)
end)
3 Likes
ldaspp
(ldaspp)
April 28, 2024, 9:12pm
#3
whenever I change the rotation, even adding the uppertorso’s rotation, It always points a different direction every time
Lauri9
(Lauri9)
April 29, 2024, 4:19am
#4
Can you show your script of your attempt? We can try fix it
ldaspp
(ldaspp)
April 29, 2024, 11:51am
#5
I just do the same thing as you, but slip this in
backitem.Rotation = v.Character:FindFirstChild("HumanoidRootPart").Rotation + Vector3.new(0,90,0)
backitem is like your newpart
Lauri9
(Lauri9)
April 29, 2024, 4:26pm
#6
Sorry for the late reply You’ll need to include the rotation data in the CFrame calculation like so:
NewPart.CFrame = UpperTorso.CFrame:ToWorldSpace(CFrame.new(0,0,(UpperTorso.Size.Z + NewPart.Size.Z)/2) * CFrame.Angles(0,0,math.rad(90)))
-- math.rad turns Degrees into radians which is what is CFrame.Angles uses in rotation
After that it is just a matter of offsetting things accordingly. Hope this helps!
1 Like
system
(system)
Closed
May 13, 2024, 4:26pm
#7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.