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 » Scripters
Home Search
 

Re: How to fix fired functions for all players?

Previous Thread :: Next Thread 
BookOfPowerz is not online. BookOfPowerz
Joined: 16 Dec 2013
Total Posts: 1082
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 is not online. Vyxinph
Joined: 03 May 2017
Total Posts: 12046
17 Jun 2017 10:21 AM
whatt
Report Abuse
BookOfPowerz is not online. BookOfPowerz
Joined: 16 Dec 2013
Total Posts: 1082
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
MidasTouched is not online. MidasTouched
Joined: 02 Dec 2016
Total Posts: 242
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
BookOfPowerz is not online. BookOfPowerz
Joined: 16 Dec 2013
Total Posts: 1082
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
MidasTouched is not online. MidasTouched
Joined: 02 Dec 2016
Total Posts: 242
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
MidasTouched is not online. MidasTouched
Joined: 02 Dec 2016
Total Posts: 242
17 Jun 2017 11:33 AM
add a wait(.25) inside the while loop but you get the idea
Report Abuse
BookOfPowerz is not online. BookOfPowerz
Joined: 16 Dec 2013
Total Posts: 1082
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
MidasTouched is not online. MidasTouched
Joined: 02 Dec 2016
Total Posts: 242
17 Jun 2017 03:55 PM
With what I just put it won't do that. Every player has a different timer.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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