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: Why does this strange phenomenon happen?

Previous Thread :: Next Thread 
CWRA0444 is not online. CWRA0444
Joined: 14 Jan 2010
Total Posts: 6013
24 Jul 2014 01:34 PM
There is a script I have where a guard walks around randomly until you enter a certain range. He will start chasing you. However, AFTER you LEAVE his range he walks around normally again, in theory. But for some reason, after you leave his range, he does walk around randomly but your movements also influence where he moves(i.e. if you go right, he will also move right while simultaniously moving in the direction that was randomly generated.) This only happens in ROBLOX Player, in Play Solo he works as intended.
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
24 Jul 2014 01:35 PM
Do you have a script to show us?
Report Abuse
CWRA0444 is not online. CWRA0444
Joined: 14 Jan 2010
Total Posts: 6013
24 Jul 2014 01:36 PM
Sure.

print'updated.'
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 35
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")
wings = temp2:findFirstChild("Wings")
if (temp ~= nil) and (wings ~= nil) and (temp.Transparency ~= 1) 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



i = 1
while true do
wait()
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
wait()
i = i + 1
if i == 12 then
script.Parent.Torso["Right Shoulder"].DesiredAngle = 1.5
script.Swoosh.Pitch = 1
script.Swoosh:play()
elseif i == 20 then
i = 1
script.Parent.Torso["Right Shoulder"].DesiredAngle = 0
script.Swoosh.Pitch = 0.8
script.Swoosh:play()
end
script.Parent.Head.BillboardGui.TextLabel.Text = "Halt, in the name of Braknir!"
script.Parent.Humanoid:MoveTo(target.Position, target)
else
script.Parent.Head.BillboardGui.TextLabel.Text = "[AVOID] Guard"
wait(math.random(0,5))
script.Parent.Humanoid:MoveTo(Vector3.new(script.Parent.Torso.Position.X + math.random(-15, 15), script.Parent.Torso.Position.Y, script.Parent.Torso.Position.Z + math.random(-15, 15)))
end
end
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 01:36 PM
That's some messed up crap.

-I just hit 4k posts, made a lengthy speech lol: http://www.roblox.com/Forum/ShowPost.aspx?PostID=141338105-
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
24 Jul 2014 01:37 PM
repeat until nil
Report Abuse
CWRA0444 is not online. CWRA0444
Joined: 14 Jan 2010
Total Posts: 6013
24 Jul 2014 01:37 PM
@Max
my script??
Report Abuse
InfamousGorillas is not online. InfamousGorillas
Joined: 22 Apr 2014
Total Posts: 52
24 Jul 2014 01:38 PM
print'updated.'
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 35
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")
wings = temp2:findFirstChild("Wings")
if (temp ~= nil) and (wings ~= nil) and (temp.Transparency ~= 1) 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



i = 1
while true do
wait()
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
wait()
i = i + 1
if i == 12 then
script.Parent.Torso["Right Shoulder"].DesiredAngle = 1.5
script.Swoosh.Pitch = 1
script.Swoosh:play()
elseif i == 20 then
i = 1
script.Parent.Torso["Right Shoulder"].DesiredAngle = 0
script.Swoosh.Pitch = 0.8
script.Swoosh:play()
end
script.Parent.Head.BillboardGui.TextLabel.Text = "Halt, in the name of Braknir!"
script.Parent.Humanoid:MoveTo(target.Position, target)
else
script.Parent.Head.BillboardGui.TextLabel.Text = "[AVOID] Guard"
wait(math.random(5, 50))
script.Parent.Humanoid:MoveTo(Vector3.new(script.Parent.Torso.Position.X + math.random(-15, 15), script.Parent.Torso.Position.Y, script.Parent.Torso.Position.Z + math.random(.15, 15)))
end
end

Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 01:39 PM
no, you ninja'd me. I was talking about the problem. I've mad my fair share of weird anomalies like that, but never that strange.

local human = nil

you can just use

local human
and define it later

-I just hit 4k posts, made a lengthy speech lol: http://www.roblox.com/Forum/ShowPost.aspx?PostID=141338105-
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
24 Jul 2014 01:44 PM
local human = nil

there is nothing wrong with that
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 01:45 PM
jus sayin it's fewer characters
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
24 Jul 2014 01:46 PM
fewer character hardly matters,
as long as it's readable it's fine(local human = nil is readable)
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 01:47 PM
it was just a tip. he can use it or not. No need to start a federal case about it :/
Report Abuse
InfamousGorillas is not online. InfamousGorillas
Joined: 22 Apr 2014
Total Posts: 52
24 Jul 2014 01:48 PM
max i swear u dont know how to even script

Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
24 Jul 2014 01:48 PM
"That's some messed up crap."

you started the case here
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 01:48 PM
talk to the bricksmith badge, kthx.

-I just hit 4k posts, made a lengthy speech lol: http://www.roblox.com/Forum/ShowPost.aspx?PostID=141338105-
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 01:49 PM
@duel, I was talking about the problem. Re-read my posts and you'll see that.
Report Abuse
InfamousGorillas is not online. InfamousGorillas
Joined: 22 Apr 2014
Total Posts: 52
24 Jul 2014 01:49 PM
that juliuscoles noob has bricksmith ur point is invalid sir

Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
24 Jul 2014 01:51 PM
bricksmith does not prove anything,
you can get bricksmith by using a comment spammer for people to join your
place for free robux.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 01:54 PM
Obviously I don't do that.

-I just hit 4k posts, made a speech lol: http://www.roblox.com/Forum/ShowPost.aspx?PostID=141338105-
Report Abuse
InfamousGorillas is not online. InfamousGorillas
Joined: 22 Apr 2014
Total Posts: 52
24 Jul 2014 01:55 PM
yh u did n0b

Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
24 Jul 2014 01:55 PM
You never know, since you don't script.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 01:56 PM
Considering I've helped in about 3k different problems, I'd say I do know what I'm talking about right now.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
24 Jul 2014 01:57 PM
All you do is rephrase the post of others -_____-

Similar people: Warspyking
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 01:58 PM
Considering all you do is mock those who have problems (and lie when you say all I do is rephrase), I'd say what I do is still more useful.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
24 Jul 2014 01:58 PM
All I do is help them -___-
ur obviously new here
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