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 » Scripters
Home Search
 

Trying to make a meteor

Previous Thread :: Next Thread 
sm1t3 is not online. sm1t3
Joined: 04 Jun 2011
Total Posts: 103
23 Jun 2015 07:26 PM
Okay I tried making a command where when you say "meteor", a meteor appears with a message. But for some reason, when i go into test mode and type meteor, nothing happens. Can someone help me resolve this problem, I think something is wrong with the script.

function processCommand(speaker, message)
if message == "meteor" then
local m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "A meteor is coming towards us!!! AHHH!!!"
wait(3)
m:remove()
local b = Instance.new("Part")
b.Parent = game.Workspace
b.Position = Vector3.new(0,5000,0)
b.Size = Vector3.new(200,500,200)
b.BrickColor = BrickColor.new(199)
b.Transparency = 0
wait(10)
b:remove()
wait(1000)
end
end

Report Abuse
sm1t3 is not online. sm1t3
Joined: 04 Jun 2011
Total Posts: 103
23 Jun 2015 07:38 PM
BUMP
Report Abuse
Lucas1270z is not online. Lucas1270z
Joined: 27 Feb 2013
Total Posts: 439
23 Jun 2015 07:39 PM
do you even have anything calling the function
Report Abuse
sm1t3 is not online. sm1t3
Joined: 04 Jun 2011
Total Posts: 103
23 Jun 2015 07:42 PM
You dont need to, I dont think so cause Its a function thats activated once you speak. @Lucas1270z
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
23 Jun 2015 07:47 PM
Uh, no its not. Theres no such thing as a function that is automatically called in Roblox Lua.

You still have to connect it to a chat event.
Add this to the bottom of the script:




function registerPlayer(player)
player.Chatted:connect(function (msg)
processCommand(player,msg)
end)
end

for _,p in pairs(game.Players:GetPlayers()) do
registerPlayer(p)
end

game.Players.PlayerAdded:connect(registerPlayer)
Report Abuse
sm1t3 is not online. sm1t3
Joined: 04 Jun 2011
Total Posts: 103
23 Jun 2015 07:52 PM
New script:
function processCommand(speaker, message)
if message == "meteor" then
local m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "A meteor is coming towards us!!! AHHH!!!"
wait(3)
m:remove()
local b = Instance.new("Part")
b.Parent = game.Workspace
b.Position = Vector3.new(0,5000,0)
b.Size = Vector3.new(200,500,200)
b.BrickColor = BrickColor.new(199)
b.Transparency = 0
wait(10)
b:remove()
wait(1000)
end
end

function registerPlayer(player)
player.Chatted:connect(function (msg)
processCommand(player,msg)
end)
end

for _,p in pairs(game.Players:GetPlayers()) do
registerPlayer(p)
end

game.Players.PlayerAdded:connect(registerPlayer)


Thank you so much for fixing it. Bless your soul xD Im still a beginner scripter so I couldnt figure it out.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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