generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Follow Script (Solo Problem)

Previous Thread :: Next Thread 
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
08 Sep 2014 02:27 PM
Hey guys, I was here before needing help with my follow script and it was perfected. What I recently realised was that it worked perfectly in Solo Mode but when I click Play (At my place), it doesn't do what it is suppose to do but instead the NPC walks to the direction I am facing.

I want to know why testing it in Solo Mode is different to actually playing at my place?

Here is the code below: (It is suppose to make the NPC follow a player when they get within a distance of 6 studs and then return to its original position when I walk 6 studs away from it but only works in Solo Mode which is odd)

local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")

HOME = script.Parent.Torso.Position



function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 6
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("Torso")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end

while true do
wait(0.1)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Zombie:MoveTo(target.Position, target)

else

script.Parent.Zombie:MoveTo(HOME)

end -- found Target or not?
end
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
08 Sep 2014 02:52 PM
Bump.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 08:27 AM
Bump.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 10:34 AM
Another Bump ...
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 11:22 AM
Bump again.
Report Abuse
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
09 Sep 2014 12:09 PM
I don't know.

I tried to go to your place, but u do not have a Place.

I would need to see how u have things set-up, and look at it in Studio....


BTW, I need Artists. Can trade scripting or anything for a really good "Eye",
Brian
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 12:25 PM
Yeah my place isn't active because it isn't finished also I don't plan on trading anything, I just want to try and get this sorted.

The health, the NPC's and other things are not doing what they are suppose to but when I play on Solo in the Studio, it is perfectly fine.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 12:38 PM
Also just a note, I tried setting up a new place with only a baseplate and the NPCs with the Follow script and shown above but still has the same problem.
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
09 Sep 2014 12:53 PM
try testing your game in server mode. here is how: in studio (if you have the old layout) go to tools -> test -> start server.

then say yes to any firewall that pops up. next go to tools -> test -> start player.

what this mode does is it simulates a online environment. basically you can simulate your game as if you were is play mode.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 01:05 PM
Yeah it doesn't work in server mode either, it seems that it only works in Solo mode which is just odd. I have a few things which work as I want it to in Solo Mode but when I test it via server mode or online, it doesn't do what I want it to do.
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
09 Sep 2014 01:09 PM
do you have the output window visible? if you do, most of the time the script will give you an error message telling you what's wrong.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 01:19 PM
I didn't have the output window visible but I recently checked it and found nothing out of the ordinary.

All I got that stood out was:
Connecting to localhost:...
Connection accepted from...

I know that this is just simply connecting but apart from that, no errors, problems or anything like that found. If you want me to copy and paste the full list then let me know but I don't think it is necessary.
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
09 Sep 2014 01:23 PM
thats because there are 2 kinds of outputs. the first kind of output is local output. this output will only output stuff to the client's output window only. the second kind of output is server output. server sided scripts will only output in the server output window. so if you are viewing the output for a client window, take a look at the server output if you are using a server sided script.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 01:54 PM
Sorry I am not good at scripting and I do not understand it, someone helped me make the script above.

I am not really sure what you are trying to ask me to do but all I know is that the script is running in both modes but in server mode and online mode, it doesn't do what it should do, it appears that only in Solo Mode is showing what I want.

Is there a way to fix this so that is works as it should in both client and server side? I tried removing everything so that there is only the NPC and the Follow Script but it appears that nothing else is effecting it that I know of.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 03:01 PM
Bump.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
09 Sep 2014 04:04 PM
Bump.
Report Abuse
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
09 Sep 2014 05:10 PM
Hey Buddy,

you r not doing anything to help your problem. Go test it, and figure-out what's wrong

if it worked before u added this, then try taking it out. Maybe at the begging of this script, the AI is not where u think it is...

HOME = script.Parent.Torso.Position


try:

HOME = Vector3.new(0,0,0) -- it should go to the middle of your Place.


Maybe u need to wait, before initializing Home.



Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
10 Sep 2014 07:08 AM
You think I haven't tested it? I wouldn't be here if I didn't test it, I am here to find out what is actually wrong with it but if you are not going to read the posts above then I will make it simple for you.

I have a follow script for a NPC that follows you when you get in range of 6 studs, when you walk 6 studs away from him, he goes back to his original position. This only appears to work in Solo Mode but does NOT work in server mode or online mode, trying your method did the exact same thing. I tried adding a wait but as said above, I have no scripting knowledge.

If anyone has an idea on why this only appears to work in Solo Mode and if there is a way to fix it, please let me know.
Report Abuse
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
10 Sep 2014 07:34 AM
Google "output roblox studio" and click on the one from wiki.roblox.com
that will show you how to toggle the output.
anyways, this is a free modeled zombie follow script.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
10 Sep 2014 10:04 AM
It isn't a free model and even if it was, why would it even matter? Read the above posts before you comment and don't say you have because someone has already spoken about the output. I am not saying I made it or copied it, I am simply saying that a friend helped me make a script and whether he copied it or not I do not know. I modified it to be a zombie so that players cannot kill each other.

I am only here to find out why it is not working and if you want to see what I am on about then visit my place, I could care less about my views but if you want to look into it then by all means.

The NPC is suppose to follow you when you get into certain range and then return to his original position when you leave a certain amount of studs away from him. When you got near the NPC and walk away from it, it doesn't do what it is suppose to but for a strange reason it works fine in Solo.

Unless you have an idea on how to help, please don't comment.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
10 Sep 2014 10:49 AM
Bump.
Report Abuse
vlekje518 is not online. vlekje518
Joined: 10 Apr 2011
Total Posts: 191
10 Sep 2014 10:54 AM
well thats FMed
atleast it rlly looks like it. - grab a zombie model and check the follow script

and second, dont expect things to work in solo, try test server or test it online.
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
10 Sep 2014 11:22 AM
Well I will say it again because clearly some forumers have trouble reading.

It works fine in Solo Mode but it does not work in server mode or online mode (Yes kids that means testing the server). You can think it is free modelled all you want but too be honest I don't care, it is just quite stupid you would rather call something a free model just because you can.

A friend helped me get the model but as said above again, I do not know whether he copied it or not but he didn't know how to finish my request but the thread below is how I got to where I am at the moment.

http://www.roblox(DOT)com/Forum/ShowPost.aspx?PostID=145379980 (Stupid blocking post... Replace "(DOT)" with ".")

TL;DR

For the last time, if you are not going to help or even have the slightest attempt to even read a post then don't bother replying.
Report Abuse
vlekje518 is not online. vlekje518
Joined: 10 Apr 2011
Total Posts: 191
10 Sep 2014 11:27 AM
he did copy it

also (Solo Problem) is a problem about solo isnt it

a wait(10) might fix the problem
Report Abuse
Bradderz369 is not online. Bradderz369
Joined: 27 Jul 2009
Total Posts: 343
10 Sep 2014 11:34 AM
"Maybe u need to wait, before initializing Home."

Already been suggested above.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image