So I have a turret that would always point at the player's mouse. I want to attach it to a car, but whenever I attach it together using Hinge, I test, the car and the turret would go flying crazy and look very glitchy. My goal is to attach the turret onto a car, without making it go haywire of course. Anyone know a solution to this? Thanks!
This is the script that makes the turret follow the player's mouse.
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function() repeat wait() until game.Workspace.TestingCannon.SpinningPart.Base while true do local pos local m = p:GetMouse() local t = m.Hit if t then pos = t local base = game.Workspace.TestingCannon.SpinningPart:WaitForChild("Base") local h = p.Character:WaitForChild("Head") base.CFrame = CFrame.new(base.Position,Vector3.new(t.X,t.Y,t.Z)) --tor["Neck"].C0 = CFrame.new(0,1,0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y) + 1.55,3.15,0) end wait() end end) end)
Base is basically the turret.
Sorry if this has nothing to do with scripting.