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 make client-side item pickups

Previous Thread :: Next Thread 
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 03:16 AM
Hello everyone. I am here because I have recently come across a roadblock in the development of a project. The roadblock I am facing is how to make client-side item pickups.

As of right now, a certain object in each level of my game can only be collected once by ONE player when touched. This poses a problem in a multiplayer game. There has to be an instance of that object for every player who has to collect it to move on.

But the question is, how do I do that? I'd really appreciate the help.


~Zilver
Report Abuse
JDLENL is online. JDLENL
Joined: 23 Dec 2009
Total Posts: 1109
04 Sep 2017 03:22 AM
roblox more like roadblocks


use filtering to only delete the pickup locally to one player, and tell the server the player picked it up to actually do stuff with the pickup
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
04 Sep 2017 03:28 AM
You could always just use FireClient to delete the part locally.
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 03:34 AM
Forgot to mention that the item stays there after pickup. It just changes color and transparency and is no longer able to add +1 to a leaderboard when collected. This is so that the level is replayable later on whenever a player wants to repeat the level.
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 05:56 AM
I've been trying different methods, but they don't work. :(
Report Abuse
mattscy is online. mattscy
Joined: 06 May 2011
Total Posts: 1079
04 Sep 2017 05:58 AM
any changes done with a LocalScript with filteringenabled on will only occur for that client, including colour changes to a part.


while true do end
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 06:07 AM
I've have FE on, and when another player interacts with the object, I can see the change on my screen too for some reason.
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 06:16 AM
Where does the LocalScript have to be placed?
Report Abuse
mattscy is online. mattscy
Joined: 06 May 2011
Total Posts: 1079
04 Sep 2017 06:23 AM
Somewhere where it is individual to the player, such as in guis or backpack


while true do end
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 06:34 AM
Thanks for the help so far. I have one problem. The parts I'm trying to make are already made. Would I have to rearrange the scripting to find the path to the part instead of using script.parent?
Report Abuse
mattscy is online. mattscy
Joined: 06 May 2011
Total Posts: 1079
04 Sep 2017 06:35 AM
Yes thats probably the best option, you could always store the parts in models for organisation too.


while true do end
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 06:42 AM
Tried finding the path and it didn't work. I'll post the script. The leaderboard addition broke when I took the LocalScript away from the object itself and put it in PlayerGuis: game.Workspace.YellowStarTest.Model.Primary.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and enabled then local player = game.Players:GetPlayerFromCharacter(hit.Parent) player.leaderstats.Stars.Value = player.leaderstats.Stars.Value + # ############################## # ############################## # 0 enabled = false wait(2) script.Parent.BrickColor = BrickColor.White() script.Parent.Transparency = 0.4 wait(1) end end)
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 06:44 AM
.-.
Report Abuse
mattscy is online. mattscy
Joined: 06 May 2011
Total Posts: 1079
04 Sep 2017 06:48 AM
instead of using GetPlayerFromCharacter you should check if hit.Parent is game.Players.LocalPlayer.Character, and if it is set player to game.Players.LocalPlayer.

Im not sure if this is the problem though, the script was a little messy.


while true do end
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 06:57 AM
enabled = true game.Workspace.YellowStarTest.Model.Primary.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and enabled then local player = game.Players:GetPlayerFromCharacter(hit.Parent) player.leaderstats.Stars.Value = player.leaderstats.Stars.Value + # ############################## # ############################## # 0 enabled = false wait(2) game.Workspace.YellowStarTest.Model.Primary.BrickColor = BrickColor.White() game.Workspace.YellowStarTest.Model.Primary.Transparency = 0.4 wait(1) end end)
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 06:59 AM
I even tried to space it out evenly ;-;
Report Abuse
ZilverLazarus is not online. ZilverLazarus
Joined: 13 Jun 2012
Total Posts: 22
04 Sep 2017 07:15 AM
I fixed the leaderboard stuff, but now things are appearing the same on both screens when I run a test server. One player can interact with the object while the other one can't interact with it.

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