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: Script help!!

Previous Thread :: Next Thread 
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
28 May 2013 09:27 AM
The !load vehicles - works on cloning the vehicle into the workspace, but the vehicle breaks apart?

and also the !clear vehicles, doesn't work.
Any help? Here is the code:


local admins = {"iceorb"}
local keyMessage = "!load vehicles"
local keyMessage2 = "!clear vehicles"


function onChatted( Chat, Player )
if Chat:lower( ) == keyMessage then
game.Lighting.Aspec:Clone().Parent = game.Workspace
wait(1)
game.Lighting.Crawler:Clone().Parent = game.Workspace
else if Chat:lower( ) == keyMessage2 then
for i, v in pairs(Workspace) do
if v.Name == "Crawler" or v.Name == "Aspec" then
v:Destroy()
end
end
end
end
end

function onPlayerEntered(newPlayer)
repeat wait() until newPlayer
newPlayer.Chatted:connect(function(msg)
for i = 1, #admins do
if newPlayer.Name:lower() == admins[i] then
onChatted(msg, newPlayer)
end
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
28 May 2013 09:31 AM
Use :MakeJoints() to ensure the welds and joints don't fall apart when it changes from Lighting to Workspace.

local p = Item:Clone()
p.Parent = Workspace
p:MakeJoints()

That should work.

Soup's on, everybody!
~LuaLearners Writer~
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
28 May 2013 09:33 AM
Also, try putting

for i, v in pairs(Workspace:GetChildren())

That was my mistake.

Soup's on, everybody!
~LuaLearners Writer~
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
28 May 2013 09:34 AM
For the :MakeJoints() - where would I put that?
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
28 May 2013 09:37 AM
Where I put in in the example

local findModel = model:Clone()
findModel.Parent = game.Workspace
findModel:MakeJoints()

Right after changing it's parent, not before.

Soup's on, everybody!
~LuaLearners Writer~
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
28 May 2013 09:39 AM
Yeah I think I've sorted it! I'll test it out!
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
28 May 2013 09:43 AM
Does it work?

Soup's on, everybody!
~LuaLearners Writer~
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
28 May 2013 10:30 AM
Haven't tested yet, but I'll see momentarally!
Report Abuse
Arkose is not online. Arkose
Joined: 26 May 2013
Total Posts: 745
28 May 2013 11:53 AM
You are trying to loop through the workspace, so you need to use :GetChildren() in this line: You also had an extra end.


Your code: for i, v in pairs(Workspace) do
My code: for i, v in pairs(Workspace:GetChildren()) do

local admins = {"iceorb"}
local keyMessage = "!load vehicles"
local keyMessage2 = "!clear vehicles"


function onChatted( Chat, Player )
if Chat:lower( ) == keyMessage then
a = game.Lighting.Aspec:Clone()
a.Parent = game.Workspace
a:MakeJoints()
wait(1)
b = game.Lighting.Crawler:Clone()
b.Parent = game.Workspace
b:MakeJoints()
else if Chat:lower( ) == keyMessage2 then
for i, v in pairs(Workspace:GetChildren()) do
if v.Name == "Crawler" or v.Name == "Aspec" then
v:Destroy()
end
end
end
end

function onPlayerEntered(newPlayer)
repeat wait() until newPlayer
newPlayer.Chatted:connect(function(msg)
for i = 1, #admins do
if newPlayer.Name:lower() == admins[i] then
onChatted(msg, newPlayer)
end
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)






Need more help? Feel free to PM me :)
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
28 May 2013 01:01 PM
^^

I already said he needed to add :GetChildren(), That was my mistake.

Soup's on, everybody!
~LuaLearners Writer~
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
28 May 2013 01:08 PM
I fixed it :3
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
28 May 2013 01:09 PM
Thanks for your help, also

if I want it to clone the vehicles into workspace how would I do that? Like especially if there is more than 1 vehicle.
will the local p = vehicle thing clone all of them?
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
28 May 2013 01:21 PM
Any help please?
It only gets one of the vehicles from lighting, and I need it to clone both but they have the same name.
Report Abuse
Arkose is not online. Arkose
Joined: 26 May 2013
Total Posts: 745
28 May 2013 01:23 PM
Change the name?






Need more help? Feel free to PM me :)
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
28 May 2013 01:26 PM
Yeah, I've just done that; just thought there was an easier way.
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
28 May 2013 02:18 PM
Use another for loop, but that's a massive waste of time. Just rename.

Soup's on, everybody!
~LuaLearners Writer~
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