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: What's wrong with this script?

Previous Thread :: Next Thread 
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
02 Sep 2011 09:55 PM
Please look for the caps part


upgradecost = 1000

dist = 20
--_________________________________________________________
enabled = true

function onClicked()
local p = game.Players:GetChildren()
for i = 1, #p do
local cash = p[i].leaderstats:findFirstChild("Money")
if cash.Value > upgradecost or cash.Value == upgradecost then
if (p[i].Character.Torso.Position - script.Parent.Position).magnitude < dist then
if not enabled then return end
enabled = false
cash.Value = cash.Value - upgradecost
--_____________________________________________Effects
script.Parent.Transparency = 1
script.Parent.Parent.Door.Transparency = 0
script.Parent.Parent.Name = "Choosing."
wait(1)
script.Parent.Parent.Name = "Choosing.."
wait(1)
script.Parent.Parent.Name = "Choosing..."
wait(1)
--_____________________________________________Random Script
local m = math.random(1,1)
if m == 1 then
game.Lighting:findFirstChild("AK47"):clone().Parent = p[i].Backpack
script.Parent.Parent.Name = "You Got an AK47!"
end

wait(2) --THIS IS THE PART THAT DOESNT WORK
script.Parent.Transparency = 0
script.Parent.Parent.Door.Transparency = 1

enabled = true
end
end
end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
GoldenUrg is not online. GoldenUrg
Joined: 23 Aug 2009
Total Posts: 6428
02 Sep 2011 10:07 PM
Mixing OnClicked and for i=1,#p doesn't seem right.

What are you trying to do? And What is it actually doing?
Report Abuse
LinkIsaiah is not online. LinkIsaiah
Joined: 01 Jan 2008
Total Posts: 410
02 Sep 2011 10:12 PM
I would first try to move that end above the "wait(2)" where the script stops working, to the bottom where the rest of the ends are
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
02 Sep 2011 10:16 PM
Didn't work.
Report Abuse
LinkIsaiah is not online. LinkIsaiah
Joined: 01 Jan 2008
Total Posts: 410
02 Sep 2011 10:19 PM
What does the output say exactly?
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
03 Sep 2011 12:20 PM
Sat Sep 03 13:18:51 2011 - Opening "C:\Users\Mike\AppData\Local\Roblox\Test\Visit.rbxl"
Sat Sep 03 13:18:52 2011 - Running Script "Workspace.Money Leaderboard"
Sat Sep 03 13:18:52 2011 - Running Script "Workspace.Random Weapon - 1000.System.Script"
Sat Sep 03 13:18:52 2011 - AddCoreScript 59431535 "BuildToolsScript" to CoreGui.RobloxGui
Sat Sep 03 13:18:52 2011 - Creating toolbar Utilities, toolbar window valid = 1, doc window valid = 1
Input Info Plugin Loaded
Sat Sep 03 13:18:53 2011 - Running Script "Script Context.StarterScript"
Sat Sep 03 13:18:53 2011 - AddCoreScript 59002209 "Sections" to Script Context
Sat Sep 03 13:18:53 2011 - AddCoreScript 35914620 "Resizer" to CoreGui.RobloxGui
Sat Sep 03 13:18:53 2011 - AddCoreScript 35914081 "SubMenuBuilder" to CoreGui.RobloxGui
Sat Sep 03 13:18:53 2011 - AddCoreScript 36868950 "ToolTipper" to CoreGui.RobloxGui
Sat Sep 03 13:18:53 2011 - AddCoreScript 46295863 "SettingsScript" to CoreGui.RobloxGui
Sat Sep 03 13:18:53 2011 - AddCoreScript 39250920 "MainBotChatScript" to CoreGui.RobloxGui
Sat Sep 03 13:18:53 2011 - AddCoreScript 48488235 "PlayerListScript" to CoreGui.RobloxGui
Sat Sep 03 13:18:53 2011 - AddCoreScript 48488451 "PopupScript" to CoreGui.RobloxGui
Sat Sep 03 13:18:53 2011 - AddCoreScript 48488398 "NotificationScript" to CoreGui.RobloxGui
Sat Sep 03 13:18:53 2011 - AddCoreScript 53878047 "BackpackBuilder" to CoreGui.RobloxGui
Sat Sep 03 13:18:53 2011 - Running Script "CoreGui.RobloxGui.BuildToolsScript"
Sat Sep 03 13:18:54 2011 - Running Script "Script Context.StarterScript"
Sat Sep 03 13:18:54 2011 - RegisterLibrary 193263448 "RbxGui"
Sat Sep 03 13:18:54 2011 - RegisterLibrary 193263448 "RbxGear"
Sat Sep 03 13:18:54 2011 - RegisterLibrary 193263448 "RbxUtility"
Sat Sep 03 13:18:54 2011 - Running Script "Script Context.Sections"
Sat Sep 03 13:18:54 2011 - Running Script "CoreGui.RobloxGui.Resizer"
Sat Sep 03 13:18:54 2011 - Running Script "CoreGui.RobloxGui.MainBotChatScript"
Sat Sep 03 13:18:54 2011 - Running Script "CoreGui.RobloxGui.PopupScript"
Sat Sep 03 13:18:54 2011 - Running Script "CoreGui.RobloxGui.NotificationScript"
Sat Sep 03 13:18:54 2011 - Running Script "Workspace.Player.RobloxTeam"
Sat Sep 03 13:18:55 2011 - Running Script "CoreGui.RobloxGui.SubMenuBuilder"
Sat Sep 03 13:18:55 2011 - Running Script "CoreGui.RobloxGui.ToolTipper"
found help in bottom right
Sat Sep 03 13:18:55 2011 - Running Script "CoreGui.RobloxGui.SettingsScript"
Sat Sep 03 13:18:56 2011 - Running Script "CoreGui.RobloxGui.BackpackBuilder"
Sat Sep 03 13:18:56 2011 - AddCoreScript 53878057 "BackpackScript" to CoreGui.RobloxGui.CurrentLoadout
Sat Sep 03 13:18:56 2011 - AddCoreScript 53878053 "BackpackResizer" to CoreGui.RobloxGui.Backpack
Sat Sep 03 13:18:56 2011 - Running Script "Workspace.Player.Animate"
Sat Sep 03 13:18:57 2011 - Running Script "CoreGui.RobloxGui.PlayerListScript"
Sat Sep 03 13:18:57 2011 - Running Script "Workspace.Player.HealthScript v3.1"
Sat Sep 03 13:18:57 2011 - AsyncHttpQueue request took 6.504007 secs
Sat Sep 03 13:18:58 2011 - AsyncHttpQueue request took 7.107992 secs
Sat Sep 03 13:18:58 2011 - Running Script "CoreGui.RobloxGui.CurrentLoadout.BackpackScript"
Sat Sep 03 13:18:58 2011 - Running Script "CoreGui.RobloxGui.Backpack.BackpackResizer"
Sat Sep 03 13:18:58 2011 - Running Script "Workspace.Player.Sound"
Sat Sep 03 13:18:58 2011 - Running Script "Workspace.Player.Health"
Time of Day Plugin Loaded
Sat Sep 03 13:18:59 2011 - PlayerHighlight should not be a child of CoreGui.RobloxGui
Sat Sep 03 13:18:59 2011 - AsyncHttpQueue request took 7.866007 secs
Sat Sep 03 13:18:59 2011 - AsyncHttpQueue request took 7.903010 secs
Sat Sep 03 13:18:59 2011 - AsyncHttpQueue request took 7.988994 secs
Sat Sep 03 13:18:59 2011 - AsyncHttpQueue request took 7.993994 secs
Sat Sep 03 13:18:59 2011 - AsyncHttpQueue request took 8.205988 secs
Sat Sep 03 13:18:59 2011 - AsyncHttpQueue request took 8.213987 secs
Sat Sep 03 13:18:59 2011 - AsyncHttpQueue request took 8.393001 secs
Sat Sep 03 13:18:59 2011 - AsyncHttpQueue request took 8.394001 secs
Sat Sep 03 13:18:59 2011 - AsyncHttpQueue request took 8.494004 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 8.540006 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 8.595000 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 8.626000 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 8.711006 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 8.759993 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 8.854983 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 8.862997 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 8.965999 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 8.974999 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 9.074003 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 9.125005 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 9.161992 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 9.330993 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 9.363992 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 9.456991 secs
Sat Sep 03 13:19:00 2011 - AsyncHttpQueue request took 9.474997 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 9.555000 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 9.579051 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 9.639079 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 9.660089 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 9.769002 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 9.777002 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 9.885047 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 9.897051 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.005412 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.030652 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.087793 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.154685 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.173520 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.265976 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.356472 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.390056 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.458087 secs
Sat Sep 03 13:19:01 2011 - AsyncHttpQueue request took 10.468995 secs
Sat Sep 03 13:19:02 2011 - AsyncHttpQueue request took 10.554956 secs
Sat Sep 03 13:19:02 2011 - AsyncHttpQueue request took 10.580003 secs
Sat Sep 03 13:19:02 2011 - AsyncHttpQueue request took 10.665993 secs
Sat Sep 03 13:19:02 2011 - AsyncHttpQueue request took 10.700990 secs
Sat Sep 03 13:19:02 2011 - AsyncHttpQueue request took 10.774010 secs
Sat Sep 03 13:19:02 2011 - AsyncHttpQueue request took 5.118020 secs
Sat Sep 03 13:19:17 2011 - Running Script "Players.Player.Backpack.Magnum.Local Gui"
Sat Sep 03 13:19:17 2011 - Running Script "Players.Player.Backpack.Magnum.PaintballShooter"
Sat Sep 03 13:19:17 2011 - Running Script "Players.Player.Backpack.Magnum.Welding"
Sat Sep 03 13:19:17 2011 - Weld should not be a child of Players.Player.Backpack.Magnum.Handle
Sat Sep 03 13:19:17 2011 - Weld should not be a child of Players.Player.Backpack.Magnum.Handle
Sat Sep 03 13:19:17 2011 - Running Script "Players.Player.Backpack.Magnum.Welding"
Sat Sep 03 13:19:17 2011 - Weld should not be a child of Players.Player.Backpack.Magnum.Handle
Sat Sep 03 13:19:17 2011 - Weld should not be a child of Players.Player.Backpack.Magnum.Handle
Report Abuse
EliteAaronChoo is not online. EliteAaronChoo
Joined: 08 Jul 2010
Total Posts: 677
03 Sep 2011 12:52 PM
Try using wait 3.
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
03 Sep 2011 12:58 PM
...Was that supposed to be a joke...?
Report Abuse
radioactivated is not online. radioactivated
Joined: 05 Sep 2009
Total Posts: 1181
03 Sep 2011 12:59 PM
What the heck. Post exactly the line indicating the script broke. I'm not going to sift through all that.
Report Abuse
Apostasy is not online. Apostasy
Joined: 29 May 2008
Total Posts: 232
03 Sep 2011 01:00 PM
It doesn't give any error or clues why this is happening. That's
why I just posted the whole thing.
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
03 Sep 2011 01:09 PM
Better way of writing it:

    local upgradecost = 1000
    local dist = 20
    local upgrading = false

    local model = script.Parent.Parent

    script.Parent.ClickDetector.MouseClick:connect(function()
        if upgrading then return end
        upgrading = true
        
        for _, player in ipairs(game.Players:GetPlayers()) do
            local cash = player.leaderstats:findFirstChild("Money")
            if cash and cash.Value >= upgradecost then
                if (player.Character.Torso.Position - script.Parent.Position).magnitude < dist then
                    cash.Value = cash.Value - upgradecost
                    -- Effects
                    script.Parent.Transparency = 1
                    model.Door.Transparency = 0
                    model.Name = "Choosing."
                    wait(1)
                    model.Name = "Choosing.."
                    wait(1)
                    model.Name = "Choosing..."
                    wait(1)
                    
                    -- Random Script
                    if math.random(1) == 1 then
                        game.Lighting:findFirstChild("AK47"):clone().Parent = player.Backpack
                        model.Name = "You Got an AK47!"
                    end

                    wait(2) --THIS IS THE PART THAT DOESNT WORK
                    script.Parent.Transparency = 0
                    model.Door.Transparency = 1
                    
                    break;
                end
            end
        end
        
        upgrading = false
    end)

How do you know that the wait(2) line isn't working?
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