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

script runs in the studio but does not run in a local server test?

Asked by 5 years ago

This question has been solved by the original poster.
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.

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 gullet 471 — 5y
0
I switched it out and it looks like it works. mantorok4866 201 — 5y

Answer this question