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

CFrame Hinge help?

Asked by 8 years ago

I've been working on a tool thats like a mini helicopter that when you left click it starts to spin and fly around and move towards where the mouse cursor is and then when you release the blades stop spinning and fall back down towards the ground. The problem I keep running into is that I can CFrame to where it spins but it spins the entire tool and you then stops, the handle is attached to the part I want to rotate on a hinge and I have a separate welding script that keeps it all together but for some reason i can't get it to rotate on the hinge continuously and to stop when I release the mouse button. This is my script so far. Rotate1 is connected to the handle by the way. Can someone help with what I need to do for the hinge because I've been going through hours of tutorials not being able to find what I need to do?

Update to script: I've been able to get the part to spin on the y axis but I haven't been able to make it so it stays put until its been clicked then after its been clicked it stays spinning until the mouse is released and if I put the tool away and then bring it up again the piece I'm rotating falls off. I've been able to weld everything but the rotating block which is Rotate1 and the Handle together, whenever I weld those it welds them just fine but doesn't spin at all. The Blades which are like the helicopter blades that are attached to the rotational brick also seem to be rotated in the wrong direction then how I built the model of the tool. I Know exactly what I want it to do, I want the tool to stay stationary when the mouse isn't being clicked but when it is clicked I want it to start spinning the motor until the Mouse is not being clicked anymore then to stop when it is not being clicked anymore.

player = game.Players.LocalPlayer
tool = script.Parent
Rotate1 = tool.Rotate1
Wing1 = game.StarterPack.Wing1
Handle = tool.Handle

local pln = script.Parent 

local w = Instance.new("Weld") 
w.Parent = Rotate1
w.Part0 = Rotate1
w.Part1 = tool.Blade1
w.C0 = CFrame.new(3,-0.65,0)
w.C1 = CFrame.new(0,0,0)

local w2 = Instance.new("Weld")
w2.Parent = Rotate1
w2.Part0 = Rotate1
w2.Part1 = tool.Blade2 
w2.C0 = CFrame.new(3,0.65,0)
w2.C1 = CFrame.new(0,0,0)

local Handle = tool.Handle
local Rotate1 = tool.Rotate1

local motor = Instance.new("Motor", game.JointsService)
motor.Part0 = Handle
motor.Part1 = Rotate1
motor.C0 = CFrame.new(3,0,0) * CFrame.Angles(0,math.rad(90),0)
motor.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
motor.MaxVelocity = math.rad(3)
        motor.DesiredAngle = math.rad(360)

function OnClicked()

    end

function OnEquipped(Mouse)  
    Mouse.Button1Down:connect(OnClicked)
end
0
Please format your code in Lua Code Block. Goulstem 8144 — 8y
0
Change the weld on the propeller to a motor, that way you can change the motor value to spin it independently aquathorn321 858 — 8y
0
ok i'll try that thanks fireball994 5 — 8y

Answer this question