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 » Game Design
Home Search
 

Re: script problom HELP

Previous Thread :: Next Thread 
JoshOctober16 is online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
27 Nov 2014 05:10 PM
I need a script that can find all the child in the model and then if the one that is the closer to the brick this script is in

for ex 97 in the distance

and the magnitude is if something is closer to 100
it wont spawn something new

but when I try it only looks like one brick is check and the other bricks don't effect the magnitude

for ex I made this script

local Test = script.Parent

while wait() do
print("start")
for i,v in pairs(workspace.Regen:GetChildren()) do
if (v.Position - Test.Position).magnitude <= 10 then
print("found")
Test.Transparency = 0.5
elseif (v.Position - Test.Position).magnitude > 10 then
print("not found")
Test.Transparency = 0
end
end
end

and when I test it only one has a effect to make the brick go transparency 0.5
and the others are ignore.

is there a way to fix this?
Report Abuse
smallshadow68 is not online. smallshadow68
Joined: 03 Feb 2013
Total Posts: 606
27 Nov 2014 05:17 PM
It sounds like you want to make all of those bricks Transparency=0.5, and in that case, you need to add "v.Transparency 0.5"

New Script
============================================================
local Test = script.Parent

while wait() do
print("start")
for i,v in pairs(workspace.Regen:GetChildren()) do
if (v.Position - Test.Position).magnitude <= 10 then
print("found")
Test.Transparency = 0.5
elseif (v.Position - Test.Position).magnitude > 10 then
print("not found")
Test.Transparency = 0
end
end
end
============================================================
Report Abuse
smallshadow68 is not online. smallshadow68
Joined: 03 Feb 2013
Total Posts: 606
27 Nov 2014 05:17 PM
IGNORE THAT. I FORGOT TO ADD THE NEW LINE. REAL NEW SCRIPT:
============================================================
local Test = script.Parent

while wait() do
print("start")
for i,v in pairs(workspace.Regen:GetChildren()) do
if (v.Position - Test.Position).magnitude <= 10 then
print("found")
Test.Transparency = 0.5
v.Transparency = 0.5
elseif (v.Position - Test.Position).magnitude > 10 then
print("not found")
Test.Transparency = 0
end
end
end
============================================================
Report Abuse
JoshOctober16 is online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
27 Nov 2014 05:27 PM
Its not about v being transparent its that when I try it
for ex one brick is brick 1 the other brick 2 no matter what it works when brick one is close but when brick 2 is close it ignores it that's the problem

what im asking is can the script check for the brick that is closest to the mainscriptbrick
Report Abuse
JoshOctober16 is online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
27 Nov 2014 08:23 PM
been trying lots of things and it still wont work
Report Abuse
JoshOctober16 is online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
28 Nov 2014 06:31 PM
bump
Report Abuse
Konner108 is not online. Konner108
Joined: 06 Apr 2013
Total Posts: 292
28 Nov 2014 06:34 PM
http://www.roblox.com/Konner108-swordfight-place?id=189003384


This is planned to be a tdm game but for now you may check out the maps there are two seperate maps Maps 1 and 2 if you would like to see a different map please party me and tell me and I will change it. I will also be giving those maps away ( When I get my game going and become a little famous ) but for now enjoy!

The current Map is map 1: " Raid in the forest!"

Map 1 story: So players are peacefully doing what players would normally do behind the walls of there ( almost ) impenetrable fortress when all of a sudden a strange aircraft appears above the the field in front of them. Raiders climd down the rope hoping to take control of the peaceful land. If the gaurds of the village can't stop them,the fortress will be taken and the mysterious raiders will rule one of the islands in the land!



Map 2 story: The sky jail cell well protected by gaurds that worked there countless times evil masterminds have tried to escape from the prison with little to no success. Until one day more mysterious aircrafts surround the prison and raiders are jumping out of them and onto the floating rock! As all war breaks out the cell gaurds will have to pull out every inch of there courage to fend off the invaders. But if they lose not only will the villains break out, the cell and perhaps the world may be taken along with it!!

Main objective: Hold out until the timer ends.
Report Abuse
JoshOctober16 is online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
28 Nov 2014 07:51 PM
um wrong forum
Report Abuse
JoshOctober16 is online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
28 Nov 2014 07:53 PM
I tested this script out and it ignores the bricks and just spams the new ones
local i = 0
local i2 = 0
local Test = script.Parent
while wait() do
print("start")
for i,v in pairs(workspace.Regen:GetChildren()) do
if i2 >= 1 and (v.Position - Test.Position).magnitude <= 10 then
print(i, v.Name)
Test.Transparency = 0
wait()
elseif i2 <= 0 and (v.Position - Test.Position).magnitude > 10 then
print("not found")
i2 = i2 + 1
Test.Transparency = 0.5
motivator=game.ReplicatedStorage.Scour:Clone()
motivator.Parent = workspace.Regen
wait()
xp = Test.Position.x
zp = Test.Position.z
motivator.Position = Vector3.new(xp, 4, zp)
wait(0.1)
elseif i2 >= 1 and (v.Position - Test.Position).magnitude >= 10 then
i2 = i2 - 1
print("not found2")
wait()
end
end
end
what am I doing wrong?
Report Abuse
JoshOctober16 is online. JoshOctober16
Joined: 07 Aug 2010
Total Posts: 375
29 Nov 2014 11:24 AM
bump2
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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