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: This script still doesn't work. I listened to all the help.

Previous Thread :: Next Thread 
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 05:37 AM
This script is from my Gun Game script, from Call of Duty, it is supposed to give you a weapon after 11 seconds. Then when you get a kill, you get a better weapon, it doesn't seem to work though. By the way, "weapon" will change.

Here is the script:

while wait() do
wait(11)
game.Lighting.SWORD:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 1 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 2 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 3 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 4 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 5 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 6 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 7 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 8 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 9 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 10 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 11 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 12 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 13 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 14 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 15 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 16 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
if Player.leaderstats.Kills.Value = 17 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
game.Lighting.Weapon:clone().Parent = player.Backpack
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
end
end
end
end
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 05:46 AM
I already gave you the working script yesterday.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 05:48 AM
You're lucky I found the script...


game.Players.PlayerAdded:connect(function(Player)
repeat wait() until Player.Kills
Player.Kills.Changed:connect(function()


if Player.Kills >= 1 and Player.Kills <= 2 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD:Clone().Parent = Player.Backpack
end

if Player.Kills >= 2 and Player.Kills <= 3 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD2:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD2:Clone().Parent = Player.Backpack
end

if Player.Kills >= 3 and Player.Kills <= 4 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD3:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD3:Clone().Parent = Player.Backpack
end


end
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 05:50 AM
Okay, I didn't realise it, Thx. So do I start if with a sword, and when I get a kill I move up?
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 05:55 AM
if Player.Kills >= 3 and Player.Kills <= 4 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()

game.ServerStorage.SWORD3:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD3:Clone().Parent = Player.Backpack
end

Only thing you have to change is the sword3 name for example, in both of them.


And the Players.Kills >= KILLSNEEDED and then KILLSNEEDED + 1 in the second one

If you know basics of scripting or basics of math, this can be very usefull to you, you can even make things that are in the next level there too!



Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 06:05 AM
Line 7 says there needs to be a ) to close ( at line 3
What do I do?
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 06:07 AM
game.Players.PlayerAdded:connect(function(Player)
repeat wait() until Player.Kills
Player.Kills.Changed:connect(function()


if Player.Kills >= 1 and Player.Kills <= 2 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD:Clone().Parent = Player.Backpack
end

if Player.Kills >= 2 and Player.Kills <= 3 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD2:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD2:Clone().Parent = Player.Backpack
end

if Player.Kills >= 3 and Player.Kills <= 4 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD3:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD3:Clone().Parent = Player.Backpack
end


end)
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 06:09 AM
Okay, here is the final script. Some errors, but I don't know how to fix it:
while wait() do
game.Players.PlayerAdded:connect(function(Player)
repeat wait() until Player.Kills
Player.Kills.Changed:connect(function()
end

wait(11)
if Player.Kills >= 1 and Player.Kills <= 2 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD:Clone().Parent = Player.Backpack
end

if Player.Kills >= 2 and Player.Kills <= 3 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD2:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD2:Clone().Parent = Player.Backpack
end

if Player.Kills >= 3 and Player.Kills <= 4 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD3:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD3:Clone().Parent = Player.Backpack
end

if Player.Kills >= 4 and Player.Kills <= 5 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD4:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD4:Clone().Parent = Player.Backpack
end

if Player.Kills >= 5 and Player.Kills <= 6 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD5:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD5:Clone().Parent = Player.Backpack
end

if Player.Kills >= 6 and Player.Kills <= 7 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD6:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD6:Clone().Parent = Player.Backpack
end

if Player.Kills >= 7 and Player.Kills <= 8 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD7:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD7:Clone().Parent = Player.Backpack
end

if Player.Kills >= 8 and Player.Kills <= 9 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD8:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD8:Clone().Parent = Player.Backpack
end

if Player.Kills >= 9 and Player.Kills <= 10 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD9:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD9:Clone().Parent = Player.Backpack
end

if Player.Kills >= 10 and Player.Kills <= 11 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD10:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD10:Clone().Parent = Player.Backpack
end

if Player.Kills >= 11 and Player.Kills <= 12 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD11:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD11:Clone().Parent = Player.Backpack
end

if Player.Kills >= 12 and Player.Kills <= 13 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD12:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD12:Clone().Parent = Player.Backpack
end

if Player.Kills >= 13 and Player.Kills <= 14 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD13:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD13:Clone().Parent = Player.Backpack
end

if Player.Kills >= 14 and Player.Kills <= 15 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD14:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD14:Clone().Parent = Player.Backpack
end

if Player.Kills >= 15 and Player.Kills <= 16 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD15:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD15:Clone().Parent = Player.Backpack
end

if Player.Kills >= 16 and Player.Kills <= 17 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD16:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD16:Clone().Parent = Player.Backpack
end

if Player.Kills >= 17 and Player.Kills <= 18 then
Player.StarterGear:ClearAllChildren()
Player.Backpack:ClearAllChildren()
game.ServerStorage.SWORD17:Clone().Parent = Player.StarterGear
game.ServerStorage.SWORD17:Clone().Parent = Player.Backpack
end

end)
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 06:11 AM
Remove the while wait() do
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 06:13 AM
Use my script.
And don't add new swords until they actually are in ServerStorage.
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 06:13 AM
Will it still loop though?
And, almost forgot. How to I get the script to stop after 360 seconds and then start again.
Thanks for everything. And last thing. This script doesn't work for some reason.

local kills = game.Players.LocalPlayer.leaderstats.Kills
local rank = game.Players.LocalPlayer.PlayerGui.Rank

rank.Text = Kills.Value
while true do
rank.Text = Kills.Changed:wait()
end
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 06:13 AM
Okay.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 06:14 AM
while true do
rank.Text = Kills.Changed:wait()
end


while true do end


???
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 06:16 AM
I didn't make, I got some help off this forum.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 06:46 AM
local kills = game.Players.LocalPlayer.leaderstats.Kills
local rank = game.Players.LocalPlayer.PlayerGui.Rank

rank.Text = Kills.Value
while true do
rank.Text = Kills.Changed:wait()
end


What is that supposed to do
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 07:06 AM
There is a GUI called rank, if you get 10 kills for example, your rank is 10. If you get 5 kills, your rank is 5. So the text is changed every time you kill someone. And, is it ment to be in the GUI, or a localscript or what?
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 07:23 AM
Localscript
LocalPlayer can only be called by a LocalScript
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 07:41 AM
Maybe that's why it doesn't work! :D Thx
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
05 Apr 2014 08:43 AM
np
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
05 Apr 2014 01:27 PM
The script still doesn't work. Here is the output:
14:54:23.667 - Http initialization M1 = 0x12ae3d4 M2=0x12ae3d8
19:18:41.086 - No active sound driver detected
Loading CFrameGUI plugin...
CFrameGUI v3.0.0 loaded
logging probability 0.52494888149663
not logging
19:18:56.861 - DataModel Loading http://www.roblox.com/asset/?id=152065434
19:21:41.788 - Unknown object class "Button" while reading XML
19:23:28.072 - Auto-Saving...
19:24:23.753 - Auto-Saving...
19:24:25.352 - No active sound driver detected
Loading CFrameGUI plugin...
CFrameGUI v3.0.0 loaded
logging probability 0.61934263130589
not logging
LinkedLeaderboard script version 5.00 loaded
19:24:31.041 - Workspace.Script:6: ')' expected (to close '(' at line 3) near 'if'
19:24:31.215 - leaderstats is not a valid member of Player
19:24:31.216 - Script 'Players.Player1.PlayerGui.Rank.Text.LocalScript', Line 1
19:24:31.217 - stack end
19:24:33.394 - Image failed to load: rbxasset://textures/ui/mouseLock_off_dn.png: File not found
19:24:33.395 - Image failed to load: rbxasset://textures/ui/mouseLock_off_sel.png: File not found
19:24:33.396 - Image failed to load: rbxasset://textures/ui/mouseLock_off_sovr.png: File not found
19:24:33.396 - Image failed to load: rbxasset://textures/ui/mouseLock_off_sdn.png: File not found
19:24:33.397 - Image failed to load: rbxasset://textures/ui/SettingsButton_sel.png: File not found
19:24:33.397 - Image failed to load: rbxasset://textures/ui/SettingsButton_sovr.png: File not found
19:24:33.398 - Image failed to load: rbxasset://textures/ui/SettingsButton_sdn.png: File not found
19:25:05.633 - Auto-Saving...
19:25:05.893 - No active sound driver detected
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