local function Attack(Target, self)
if not Target then return end
--Fire Gun
-- Pew pew
-- Account for reload and stuff, idk
--- Ehh
local Tween = TS:Create(self.Char.PrimaryPart, Info, {CFrame = CFrame.lookAt(self.Char.PrimaryPart.Position, Vector3.new(Target.Parent.PrimaryPart.Position.X,self.Char.PrimaryPart.Position.Y ,Target.Parent.PrimaryPart.Position.Z)) })
Tween:Play()
Tween.Completed:Wait()
if Target.Parent:FindFirstChild("Humanoid") then
local Hum = Target.Parent:FindFirstChild("Humanoid")
--Hum:TakeDamage(10)
end
end
function BotFunctions.New(Char)
local self = setmetatable({ }, BotFunctions)
self.Char = Char
self.Attacking = false
return self
end
function BotFunctions:StartLooking()
while wait(1) do
local Hit = FindPlayers(self.Char)
if Hit then
if Hit.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(Hit.Parent) then
Attack(Hit, self)
self.Attacking = true
end
end
end
end
It’s centered from here. Try to center it from where you want it to be.
I’m thinking its because your turret is one union, and its center from the center of the volume. Try to add another invisible brick, and then weld the turret to its center.
Try Printing the Position of both the turret and the base.
I’m not much of a scripter, but I’m guessing that you could figure out the offset by just placing a Cylindrical Part in line with the center of the turret top (have the turret centered on the X axis), and then be able to calculate the difference there.
Example: turret top is at 0,4,0 but cylinder is at 2.392,4,0 then you know the offset is 2.392
Also you should be locating the turret at the center (X,Z) of the base’s Position, not the center of the turret’s Position.
I like easy solutions, so instead of adjusting the script, I would adjust the model.
what is happening is that your turret is a model with a center.
this script rotates that model around that center.
if you move that center by placing a block without collision and transparency=1 on the opposite side of the turret the center will be more pushed towards the base, it does take some fiddling