|
| 17 Jun 2017 10:15 AM |
So lets say there are 2 people in a server using the same attack. After pressing the key 'X' it will fire the attack. However, if one of those 2 players use the attack first, the second one would have to wait to use it then. This will keep on continuing. How can I fix it so they can both use it at the same time?
I was thinking of duplicating the fired attack 5 times and then picking a random one out of them.
#code print("Lightning Flame Dragon Mode...") --I am totally not Natsu Dragneel |
|
|
| Report Abuse |
|
|
Vyxinph
|
  |
| Joined: 03 May 2017 |
| Total Posts: 12046 |
|
| |
|
|
| 17 Jun 2017 10:22 AM |
I tried to explain it :/ I don' think there is any other way of explaining it.
#code print("Lightning Flame Dragon Mode...") --I am totally not Natsu Dragneel |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2017 10:24 AM |
| I'm I think what he means is he has a client to server event for when the player presses the attack key, and the attack has a cool down. What you need to do is store each players cool down somewhere, like in their player or serverstorage or a table, and then when the server event is fired, use the player parameter to find out which player used it, and then countdown their cool down only. |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2017 10:27 AM |
I have done that but like this is a bit clearer: So basically, if you both use the attack at the same time, it will fire the event (in workspace) and then the attack will only use for the player that used it first. After the 5 seconds (thats the cooldown of the attack) are over, another player can use the attack again. How do I make it so all players can use it at the same time?
#code print("Lightning Flame Dragon Mode...") --I am totally not Natsu Dragneel |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2017 11:31 AM |
Yeah, when a player joins the game create a number value inside their character and name it cooldown. When the event fires:
if player.Cooldown.Value <= 0 then stuff player.Cooldown.Value = time you want while(player.Cooldown.Value > 0)do player.Cooldown.Value = player.Cooldown.Value - .25 end end |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2017 11:33 AM |
| add a wait(.25) inside the while loop but you get the idea |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2017 02:19 PM |
yeah, but like if the attack is working for 1 player, then other players would have to wait.
#code print("Lightning Flame Dragon Mode...") --I am totally not Natsu Dragneel |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2017 03:55 PM |
| With what I just put it won't do that. Every player has a different timer. |
|
|
| Report Abuse |
|
|