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: RemoteEvents and ClickDetectors

Previous Thread :: Next Thread 
Badandy11 is not online. Badandy11
Joined: 02 Jul 2009
Total Posts: 1861
11 Jun 2016 02:12 PM
I just have a quick question, I have multiple chests that use click detectors and I don't want to make a local script for each chest to put into the player. Currently I have this in the local script:

print("LocalScript Loaded");
function fire()

game.Workspace.Chest.ChestOpen:FireServer();
print("Fired to Server");
end

game.Workspace.Chest.ClickDetector.MouseClick:connect(fire);

--

I don't really know how to apply to this script to all the chests the player might encounter.
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
11 Jun 2016 02:16 PM
Okay, so what you can do is use a loop to apply this function to all chests. I would group all the chests under 1 model to make it easy.


chests = workspace.ChestModel:GetChildren() -- I named it ChestModel

for i,v in pairs(chests) do
v.ClickDetector.MouseClick:connect(function()
workspace.Chest.ChestOpen:FireServer()
end)
end


Report Abuse
Badandy11 is not online. Badandy11
Joined: 02 Jul 2009
Total Posts: 1861
11 Jun 2016 02:26 PM
I group everything in folders so I can move them freely easily but it worked well, thank you. One thing that may be an issue is that chests are removed / added when events occur or when they are opened, they are destroyed. So I would have to get the list of chests every so often but I'm afraid of if it's in between a refresh and they try opening a new one, it may fail.
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
11 Jun 2016 02:27 PM
You can add a variable that checks whether or not a refresh is ongoing, and if so, all chests are disabled until it's clear.


Report Abuse
Badandy11 is not online. Badandy11
Joined: 02 Jul 2009
Total Posts: 1861
11 Jun 2016 02:28 PM
How often do you think chests should be refreshed?
Report Abuse
Badandy11 is not online. Badandy11
Joined: 02 Jul 2009
Total Posts: 1861
11 Jun 2016 02:34 PM
Says you replied but I can't see it so I'm posting to see ;o
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
11 Jun 2016 02:36 PM
It keeps blocking my post

If chests are something you find, set the refresh timer high and randomly so that people can't reliably farm.

depends on the size of your map too ¯\_(ツ)_/¯


Report Abuse
Badandy11 is not online. Badandy11
Joined: 02 Jul 2009
Total Posts: 1861
11 Jun 2016 02:37 PM
One last question, is this all worth it along with Filtering Enabled? It seemed so much easier without Filtering Enabled but I don't know much about it.
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
11 Jun 2016 02:39 PM
I felt the same way a few months ago when I started trying to get back into developing, constantly asking myself if FE was really worth it.

The short answer is: yes, FE is 100% worth it.
Curt answer: If you don't use FE, your game will get exploited.


Report Abuse
Badandy11 is not online. Badandy11
Joined: 02 Jul 2009
Total Posts: 1861
11 Jun 2016 02:41 PM
Well I guess the extra work is worth it then, exploiting could ruin my game. Does it stop exploiting 100%?
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
11 Jun 2016 02:42 PM
If you practice safe client-server relationships, then yes. Just make sure that the server gets the final say. Don't EVER trust the client's information send via RemoteEvents, always make sure the server can prove it.


Report Abuse
Badandy11 is not online. Badandy11
Joined: 02 Jul 2009
Total Posts: 1861
11 Jun 2016 02:43 PM
It's Websites all over again... I mostly program in PHP and the amount of checks I have to do to make sure their actions are valid and right... it's insane but you can never trust the user or players on ROBLOX
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