Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a flag stick to the back of a player?

Asked by 4 years ago

I am trying to ake a capture the flag, but I don't know how to make the flag stick to the back of the player. Does this have to do with the CFrame?

0
i don't have time to write a proper response, but weld the flag to the back of the model using weld constraints then set the primarypartcframe of the flag using flag:SetPrimaryPartCFrame() to be the cframe of the players humanoid root part. then offset the flag by half of the humanoid root part's size on the z axis to make sure that it is on the players back instead of in themiddle of the humanoid royaltoe 5144 — 4y
0
after welding cframe goes something like this: flag:SetPrimaryPartCFrame(character.HumanoidRootPart.CFrame * CFrame.new(0,0,character.HumanoidRootPart.Size.Z/2))  royaltoe 5144 — 4y
0
ok thank you so much demo86550 -5 — 4y
0
np np lmk if you need more help royaltoe 5144 — 4y
0
It's easier with Attachments. Overscores 381 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

You can make it stick to the player with a 'WeldConstraint'. Here's how.

local weld = Instance.new("WeldConstraint")
weld.Part0 = flag
weld.Part1 = character.HumanoidRootPart -- I believe this works in both r6 and r15.
weld.Parent = flag
flag.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(Vector3.new(0,0,-1)) --[[ This puts the flag on the player's back, but you can mess around with it and see what works best for you. ]]

If you have any questions, please comment.

Ad

Answer this question