In my script I am trying to use CFrame to spawn an Instance.new onto the leg.
I will include the FULL script and the parts only directly related to the Cframe. Also, below the fool script is also an explanation about what im trying to do (if you wanna know)
Full Complete script that contains tool variables and functions ETC
local Player = game:GetService("Players").LocalPlayer local Mouse = Player:GetMouse() local tool = script.Parent tool.Activated:Connect(function() wait(0.1) local MouseTargetParent = Mouse.Target.Parent print(MouseTargetParent) local HumanoidFinder = MouseTargetParent:FindFirstChild("Humanoid") if HumanoidFinder.Name == "Humanoid" then local leg = HumanoidFinder.Parent:FindFirstChild("LeftLowerLeg") local Tie = Instance.new("RopeConstraint") local Rock = Instance.new("Part", workspace) local AttachmentBase = Instance.new("Attachment") local AttachmentSide = Instance.new("Attachment") Tie.Parent = MouseTargetParent:FindFirstChild("LeftLowerLeg") AttachmentBase.Parent = MouseTargetParent:FindFirstChild("LeftLowerLeg") AttachmentSide.Parent = Rock Rock.CFrame = CFrame.new(leg,leg,leg) Tie.Attachment0 = AttachmentBase Tie.Attachment1 = AttachmentSide Tie.Length = 1000 Tie.Visible = true else do print("e") return end end end)
That is the full script that has everything inside it, the purpose is so that when you click someone, a rope gets tied to their legs with a rock as the thing its tied to, in this instance, a rock,
Secondly, The Condensed version (basically a TLDR, Also includes the variables for the attachments + rope!)
tool.Activated:Connect(function() local leg = HumanoidFinder.Parent:FindFirstChild("LeftLowerLeg") local Tie = Instance.new("RopeConstraint") local Rock = Instance.new("Part", workspace) local AttachmentBase = Instance.new("Attachment") local AttachmentSide = Instance.new("Attachment") Tie.Parent = MouseTargetParent:FindFirstChild("LeftLowerLeg") AttachmentBase.Parent = MouseTargetParent:FindFirstChild("LeftLowerLeg") AttachmentSide.Parent = Rock Rock.CFrame = CFrame.new(leg,leg,leg) Tie.Attachment0 = AttachmentBase Tie.Attachment1 = AttachmentSide Tie.Length = 1000 Tie.Visible = true
Why are you putting legs on your CFrame :scream: :scream:
Rock.CFrame = CFrame.new(leg,leg,leg)
should be:
Rock.CFrame = leg.CFrame
Basically replacing Rock.CFrame to leg's CFrame
Hello Firend, I wanted to note that I dont think
local Mouse = Player:GetMouse()
Is a thing Use
local Mouse = game:GetService("UserInputService")
and
You can use for Player
local Player = game.Players.LocalPlayer
Note: I am not sure if it will work + I don't know anything about Cframe Just a little Like teleporting a player and parts and that's all