local target = script.Parent.Parent.Parent.Parent.Parent.MainBase.MasterCore.Values.Target

while true do

wait()

if target.Value == nil then

end

if target.Value ~= nil then -- find a ship in workspace that matches target--

local enemytarget = game.Workspace:FindFirstChild(target.Value)

if enemytarget ~= nil and enemytarget.Name == target.Value then--check for a match--

local part1 = script.Parent

local part2 = enemytarget:FindFirstChild("CurrentHull").Center

local bg = script.Parent.Aimer

bg.MaxTorque = Vector3.new(40000,40000,40000)

bg.CFrame = CFrame.new(part1.Position, part2.Position)

end

end

end

this script runs fine without errors in the studio, but when I run it through a test server it cannot find "CurrentHull" and an error comes up.

2 comments

0

Then CurrentHull probably didn't exist yet when running or it only exist on a certain/server client which studio didn't simulate correctly. Perhaps you need WaitForChild

0

I switched it out and it looks like it works.