|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 04 Sep 2017 05:56 AM |
| I've been trying different methods, but they don't work. :( |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 04 Sep 2017 06:16 AM |
| Where does the LocalScript have to be placed? |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|
|
| 04 Sep 2017 06:59 AM |
| I even tried to space it out evenly ;-; |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|