Hello everyone!
I am making a combat game but I stumbled across the CFrame not setting it’s orientation right.
Image: https://gyazo.com/1c9af890ca6271cb6a24d4504dc44846
I have the CanCollide set to false and the anchored set to false when the player equips the armor.
local tool = script.Parent
tool.Parent.Equipped:Connect(function()
tool.Parent.Activated:Connect(function()
local char = script.Parent.Parent.Parent
if not char:FindFirstChild("BodyArmor") then
local torso = char:WaitForChild("Torso")
local hum = char:WaitForChild("Humanoid")
char.Humanoid.WalkSpeed = 0
local theclone = script.Parent.Parent.BodyArmor:Clone()
local function ee ()
theclone.Body.BodyArmor.Anchored = false
theclone.LeftArm.BodyArmor.Anchored = false
theclone.RightArm.BodyArmor.Anchored = false
theclone.Body.BodyArmor.WeldConstraint.Enabled = true
theclone.RightArm.BodyArmor.WeldConstraint.Enabled = true
theclone.LeftArm.BodyArmor.WeldConstraint.Enabled = true
theclone.Body.BodyArmor.WeldConstraint.Part1 = char:WaitForChild("Torso")
theclone.RightArm.BodyArmor.WeldConstraint.Part1 = char:WaitForChild("Right Arm")
theclone.LeftArm.BodyArmor.WeldConstraint.Part1 = char:WaitForChild("Left Arm")
end
theclone:WaitForChild("Body").BodyArmor.CFrame = torso.CFrame
theclone.Body.PrimaryPart.Orientation = char.Head.CFrame.LookVector*3
theclone:WaitForChild("LeftArm"):SetPrimaryPartCFrame(char:WaitForChild("Left Arm").CFrame, CFrame.new(char.Torso.Position + char.Torso.CFrame.LookVector*3))
theclone:WaitForChild("RightArm"):SetPrimaryPartCFrame(char:WaitForChild("Right Arm").CFrame, CFrame.new(char.Torso.Position + char.Torso.CFrame.LookVector*3))
spawn(ee)
wait()
script.Parent.Sound:Play()
theclone.Parent = char
wait(1)
char.Humanoid.WalkSpeed = 16
hum.MaxHealth = hum.MaxHealth + 100
hum.Health = hum.Health + 100
char:WaitForChild("Integrity").Torso.Value = char:WaitForChild("Integrity").Torso.Value + 150
script.Parent:Destroy()
end
end)
end)