the gun works just fine when it is anchored, but when i put it on a car, it freaks out, but still works a bit.
was playing a game on roblox, that was the backround sounds
here is the script:
local event = game:GetService("ReplicatedStorage").Events.GEEE
local e = script.Parent.Handle
event.OnServerEvent:Connect(function(plr,lr)
local spreada = CFrame.Angles(0,-1.571,0)
local direction = (lr - e.Position).unit
local boi = (e.Parent.Position+Vector3.new(0,1.571,0)) + direction
e.CFrame = CFrame.new(e.Parent.Position+Vector3.new(0,1.571,0),boi)*spreada
--On the client script gets the player that is in the seat and transfers Mouse.Hit.Position to here
end)
here is an image of the model in the explorer if you want it:
This is most likely because you are directly manipulating the cframe of the object instead of using the constraints to rotate it. Try doing that instead.
You can also rotate it by modifying the attachment CFrames instead which are relative to the part it’s stuck on.
If you are trying to rotate a hinge, set it to Servo and change the TargetAngle property.
If you want to use an attachment, Just set the attachments CFrame of whatever attachment (not constraint) the gun is welded by.
i just realized that the upper limit was set low, and when i set the upper limit to a high negative, and then the gun doesn’t pull the car with it.
but that makes it so the gun falls behind the car. But this is an easy fix, which adds the velocity of the base to the gun position, so now it doesn’t fall behind.