while targetfound == false do for i, v in pairs(Workspace:GetChildren()) do if v:FindFirstChild("Target") ~= nil then target = v -- line 48 print("target") if (script.Parent.Position - target.Position).magnitude < range then print("in range") targetfound = true print("TargetfoundMG == "..tostring(targetfound)) repeat move(target) print("fire") fire(target) wait(5) until target == nil or (script.Parent.Position - target.Position).magnitude > range print("target lost") targetfound = false print("TargetfoundMG == "..tostring(targetfound)) end end end wait(.5) end
This is a snippet from a target finding system (sorta obvious) in this case it is trying to find a string value named "Target" that has the value "Target" this is the error I get
"23:33:45.046 - Position is not a valid member of StringValue 23:33:45.047 - Script 'Workspace.MG Turret.Rocket.MGFire', Line 48 23:33:45.047 - Stack End"
If you feel trusting enough to open a link, here's the hierarchy of the part: http://prntscr.com/3jmpnw if not then I'll try to explain it Follower (a part) Health (number value) Target (the string value) BodyPosition Script (to make the bodyposition follow my character for testing purposes)
I'm sorry if I haven't thoroughly explained, it's just that I have no clue why this is happening.
(Edited to include the whole target finding script)