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: is there a more efficient way to do this

Previous Thread :: Next Thread 
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
09 Aug 2016 11:47 AM
right now i have a bow

it has 3 script components

the localscript in the tool
a module script
and then a server script

localscript uses module to fire to server and all that junk


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
09 Aug 2016 11:49 AM
It can just be as simple as:

LocalScript fires RemoteEvent in ReplicatedStorage
ServerScript listens for RemoteEvent.OnServerEvent(plr)
ServerScript generates arrow and sets network ownership to the server


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
09 Aug 2016 11:51 AM
@Soy

i was using module scripts for "clean" code but it just seems kind of unnecessary

is that what you're implying


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
09 Aug 2016 11:52 AM
Yes


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
09 Aug 2016 11:54 AM
well my firing system with fe is pretty solid right now

i fire arrow client side, invoke server to return arrow it fires on the server, then make that invisible on the client that fired

it works surprisingly well

should i make a separate server script for every weapon then


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
09 Aug 2016 11:56 AM
Nah, you could just make one that listens for all the events, and generates a different bullet depending on which thing you fired.

Or, if it's even simpler a system where you're only changing the projectile, you can use 1 event and pass information about the projectile as arguments.

For example

:FireServer("Laser")

then the server script is all like:

event.OnServerEvent:connect(function(player,projectile)
if projectile == "Laser" then
-- make laser
elseif projectile == "Arrow" then
-- make arrow
-- and so on
end
end)




Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
09 Aug 2016 11:58 AM
my projectiles are annoying and i have to change them with math to make them go straight

one server script for each type of projectile might be good since there's only 3


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
09 Aug 2016 12:00 PM
I mean, why make 3 scripts when you could just make 3 events in one script

Arrow.OnServerEvent:connect(function(player)
-- make arrow
end)

Bullet.OnServerEvent:connect(function(player)
-- make arrow
end)

Laser.OnServerEvent:connect(function(player)
-- make arrow
end)


Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
09 Aug 2016 12:01 PM
*
-- make bullet
-- make laser


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
09 Aug 2016 12:02 PM
i suppose so, is there a performance difference or something


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
09 Aug 2016 12:03 PM
Nope, just organization


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
09 Aug 2016 12:03 PM
also, do you think this is an ok way to throttle it and check for exploiters

have a variable called queuesize, that goes up by 1 and down by 1 when a projectile is made and destroyed

if the queuesize is higher than the fire rate should allow, kick the player


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
09 Aug 2016 12:07 PM
Something like that should work, just make sure you give them a little bit of leeway to account for ping if you really want to kick them. They could have 5 projectiles locally but if a lag spike hits or if their latency is really high, they could send those 5 plus a few more to the server. Though, I don't know if your system is set so they could queue up like that in the first place.

Just cap it instead of kick :^)


Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
09 Aug 2016 12:09 PM
it only lets them fire after the client to server interaction has entirely finished

so the only way that can go up is if an exploiter is spamming the remote event

if you lag it will just slow your firing rate i think


Formerly xXTheRobotXx, add 13,349 posts
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
09 Aug 2016 12:17 PM
Well if you just generate the bullets on the server you won't have this problem :)


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