I’m working on a customization screen where you can rotate your character with your mouse using the new drag detector and a CylindricalConstraint.
For some reason the CylindricalConstraint does work (when I walk into it the clone turns the way it’s supposed to) but whenever I try and use the DragDetector on it nothing happens.
I’ve tried just inserting the character in studio the same exact way but without using a script and it all worked perfectly.
My code:
function LoadInCharacter()
local seatoffset = calculateSeatOffset(Character)
print(seatoffset)
local pad = workspace:FindFirstChild("Pad")
if not pad then
warn("Pad not found!")
return
end
local padPosition = pad.Position
local attachment0 = pad:FindFirstChild("Attachment0")
if not attachment0 then
warn("Attachment0 not found on pad!")
return
end
if Character and Character:IsA("Model") and Character:FindFirstChild("HumanoidRootPart") then
if not Character.Archivable then
Character.Archivable = true
end
local characterClone = Character:Clone()
characterClone.Parent = workspace
characterClone.Name = Player.Name .. "clone"
local attachment1 = Instance.new("Attachment")
attachment1.Name = "Attachment1"
attachment1.CFrame = attachment1.CFrame * CFrame.Angles(0, 0, math.rad(90))
attachment1.Parent = characterClone.HumanoidRootPart
attachment1.CFrame = attachment1.CFrame * CFrame.new(-seatoffset, 0, 0)
local rotationConstraint = Instance.new("CylindricalConstraint")
rotationConstraint.Attachment0 = attachment0
rotationConstraint.Attachment1 = attachment1
rotationConstraint.Parent = characterClone
local dragDetector = Instance.new("DragDetector")
dragDetector.Parent = characterClone
characterClone:MoveTo(padPosition)
else
warn("Character or required parts not found! Character leads to: " .. (Character and Character.Name or "nil"))
end
end
A video of me walking into it and the Constraint doing it’s job spledidly:
https://gyazo.com/e19db7f01de42e40cded4e5d0d718713