yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 27 Apr 2014 09:18 AM |
Basically i am making a swordfighting game and i want noone to be able to hurt others in the lobby. How would i achieve this easiest -- changing sword damage or giving ff to all players. WHichever way can someone explain how i would do it
|
|
|
| Report Abuse |
|
|
|
| 27 Apr 2014 09:20 AM |
I would recommend to remove the swords from the player when they are in the lobby, and give them back when they're out of the lobby.
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 27 Apr 2014 09:21 AM |
| Would i just put it in server storage then clone it when it is time to fight? |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 27 Apr 2014 09:23 AM |
If so how would i give every player a sword. What would i parent it as or would i use a for loop, if so how would i do it??
Something like --?
for i = 0, i < game.Players:getChildren() sword = game.ServerStorage.LinkedSword:clone() sword.Parent = i.Character.Backpack end |
|
|
| Report Abuse |
|
|
|
| 27 Apr 2014 09:25 AM |
Make a bool value in the player and name it something like "InArena". Make a script to check if InArena's value is false, then to remove the sword from the player, if they have one. Else, clone the sword to the players backpack. I wouldn't recommend using a loop, but to just have a script to give the player the value in Workspace, and a local script in StarterGui or StarterPack to control if the sword should be removed, or given to the player.
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 27 Apr 2014 09:27 AM |
| How do i acces the players backpack?? |
|
|
| Report Abuse |
|
|
|
| 27 Apr 2014 09:30 AM |
If you put a localscript in the StarterPack, it'll go directly to the player's backpack, but would also go to the player's StarterGear, so just make an if statement to keep the script enabled if it's parent is in the player's Backpack, or disable it if it isn't.
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 27 Apr 2014 09:33 AM |
| Ok, also just for futue use how would i give and take away a forcefield to and from all players |
|
|
| Report Abuse |
|
|
|
| 27 Apr 2014 09:35 AM |
Instance.new("ForceField", p) --Change p to the player's character.
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 27 Apr 2014 09:36 AM |
| Yes, but how would i add it to all players not just one player |
|
|
| Report Abuse |
|
|
|
| 27 Apr 2014 09:38 AM |
for i,v in pairs(game.Players:GetChildren()) do Instance.new("ForceField", v.Character) end
This would give a forcefield to everyone currently in the game when the script was run.
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
NeonRiver
|
  |
| Joined: 12 Feb 2013 |
| Total Posts: 4936 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 27 Apr 2014 09:40 AM |
| Ty for telling me how to give all players forcefield, can you help me with how i would take them all away |
|
|
| Report Abuse |
|
|
|
| 27 Apr 2014 09:46 AM |
Improved it:
for i,v in pairs(game.Players:GetChildren()) do if not v.Character:FindFirstChild("ForceField") Instance.new("ForceField", v.Character) else v.Character:FindFirstChild("ForceField"):Destroy() end
Gives the player a forcefield if they don't have one already, otherwise it destroys it if the player already has one.
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 27 Apr 2014 09:49 AM |
| So how do i take evereyones forcefield away at once |
|
|
| Report Abuse |
|
|
|
| 27 Apr 2014 09:50 AM |
for i,v in pairs(game.Players:GetChildren()) do if v.Character:FindFirstChild("ForceField") v.Character:FindFirstChild("ForceField"):Destroy() end end
Also, don't use that "improved" script, it fails. XD
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
|
| 27 Apr 2014 09:52 AM |
No problem :)
Here's my siggy... Done. |
|
|
| Report Abuse |
|
|