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
 

Bricks don't position themselves correctly..?

Previous Thread :: Next Thread 
Placen is not online. Placen
Joined: 28 Feb 2009
Total Posts: 4496
07 Aug 2013 06:26 PM
So I'm trying to create a script where when the parent brick falls onto another part named "Lava", a pillar of white bricks will form around where the brick fell into the lava. But for some reason, the bricks don't do that. They form completely away from the brick, even though the distance isn't much. It also does this for the explosions too. I have no idea why this happens. The output shows nothing strange either. Can someone please help me fix it? Sorry if it's long. :(

a = 0
p = game.Workspace:GetChildren()
dev = script.Parent
pos = dev.Position

dev.Touched:connect(function(part) --Problem is probably between here
if part.Name == "Lava" then
if dev.Anchored == false then
wait(5)
dev.Anchored = true
wait(1)
for i = 1, 10 do
b = Instance.new("Part", Workspace)
b.Name = "Debris"
b.Position = pos + Vector3.new(pos.x+5,pos.y+a,pos.z)
b.Size = Vector3.new(2,1.2,9)
b.BrickColor = BrickColor.new("White")
c = Instance.new("Part", Workspace)
c.Name = "Debris"
c.Position = pos + Vector3.new(pos.x-5,pos.y+a,pos.z)
c.Size = Vector3.new(2,1.2,9)
c.BrickColor = BrickColor.new("White")
d = Instance.new("Part", Workspace)
d.Name = "Debris"
d.Position = pos + Vector3.new(pos.x,pos.y+a,pos.z+3.5)
d.Size = Vector3.new(8,1.2,2)
d.BrickColor = BrickColor.new("White")
e = Instance.new("Part", Workspace)
e.Name = "Debris"
e.Position = pos + Vector3.new(pos.x,pos.y+a,pos.z-3.5)
e.Size = Vector3.new(8,1.2,2)
e.BrickColor = BrickColor.new("White")
a = a+1
wait(.05)
end
end
end --And here

if dev.Anchored == true then --And possibly between here
dev.Anchored = false
wait(.5)
f = Instance.new("Explosion", Workspace)
f.Position = pos + Vector3.new(pos.x,pos.y+3,pos.z)
f.BlastRadius = 5
f.BlastPressure = 25
wait(.3)
g = Instance.new("Explosion", Workspace)
g.Position = pos + Vector3.new(pos.x,pos.y+6,pos.z)
g.BlastRadius = 5
g.BlastPressure = 25
wait(.3)
h = Instance.new("Explosion", Workspace)
h.Position = pos + Vector3.new(pos.x,pos.y+9,pos.z)
h.BlastRadius = 5
h.BlastPressure = 25
wait(.3)
end --And here
for i = 1, #p do
if p[i].Name == "Debris" then
for i = 0, 1, .1 do
p[i].Transparency = i
wait(.05)
end
p[i]:remove()
end
end
end)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Aug 2013 06:40 PM
.Position is checked for collisions, and places on a possible spot.
As in:

brick:
=========
===|=====
=========

You want to move it "|" with .Position, but it will move it to the top of the brick.
Use .CFrame
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