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 says "Failed" then stops

Previous Thread :: Next Thread 
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
17 Dec 2012 09:18 PM
levels = {"1","2","3","4","5","6","7","8"}

script.Parent.Changed:connect(function(property)
if property == "Text" then
local text = script.Parent
local player = script.Parent.Parent.Parent.Parent.Parent
local character = player.Character
for _,levels in pairs(levels) do
if text.Text == levels then
character:MoveTo(Game.Workspace["Stage"..tostring(text.Text)].SpawnLocation.CFrame.p)
text.Text = "Success"
wait(1.5)
text.Text = "#"
else
text.Text = "Failed" -- LINE 15
wait(1.5)
text.Text = "#"
end
end
end
end)

First when I enter a number, say 5, it says "Failed" in the box, the text doesn't go back to "#", and also freezes my character, but I'm still able to move around.
Suggestions?
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
17 Dec 2012 09:20 PM
Any output?

~ Usering ~
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
17 Dec 2012 09:20 PM
No \:
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
17 Dec 2012 09:20 PM
levels = {"1","2","3","4","5","6","7","8"}
local scripting = false

script.Parent.Changed:connect(function(property)
if property == "Text" and not scripting then
scripting = true
local text = script.Parent
local player = script.Parent.Parent.Parent.Parent.Parent
local character = player.Character
for _,levels in pairs(levels) do
if text.Text == levels then
character:MoveTo(Game.Workspace["Stage"..tostring(text.Text)].SpawnLocation.CFrame.p)
text.Text = "Success"
wait(1.5)
text.Text = "#"
else
text.Text = "Failed" -- LINE 15
wait(1.5)
text.Text = "#"
end
end
scripting = false
end
end)


The problem was the fact that you kept changing the Text property, which ran the event again and again and again. Adding a debounce will fix this.
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
17 Dec 2012 09:31 PM
asldkfja;skdjf
It works about 10% of the time.
And the only times it has worked was when I teleported to 1.
Not to mention it doesn't even function when playing online mode.
:/
Why is this giving me so much troubles?
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
17 Dec 2012 09:32 PM
Forgot to mention,
I type in '1', then it says success, I try it again, it says success then failed.
Then after it says failed it never works until I reset
Report Abuse
CokeCody is not online. CokeCody
Joined: 31 Mar 2010
Total Posts: 394
17 Dec 2012 09:46 PM
Nevermind I give up I'll just make chat commands, that's much easier. I'll come back to this another day.
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