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: Help Detect Entity (Multiplayer)

Previous Thread :: Next Thread 
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
23 Jul 2015 01:04 PM
I have a problem. I'm trying to make a script , that if a "Minion" touch a tree it will cut it down and give the ressources to their Master (The Player). It's work in singleplayer but not in multiplayer.

Here's the script

Tree = script.Parent
Chopped = Tree.Chopped
Stump = Tree.Stump
Cant = 0

Stump.Touched:connect(function(hit)
local Worker = game.Workspace.Worker
local Master = game.Workspace.Worker:FindFirstChild("Master")
local Cutter = game.Players:FindFirstChild(Master.Value)
local Wood = Cutter:FindFirstChild("Wood")
Wood = Cutter:FindFirstChild("Wood")
local hum = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")
if hum.Parent == Worker then
if Cant == 0 then
Cant = 1
repeat wait()
until
Tree:FindFirstChild("Trunk") and Tree:FindFirstChild("Leaves")
local Trunk = Tree.Trunk
local Leaves = Tree.Leaves
Leaves:Destroy()
Trunk:Destroy()
Wood.Value = Wood.Value + 1
Chopped.Value = 1
wait(20.1)
Cant = 0
end
end
end)
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
23 Jul 2015 01:25 PM
BUMP
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
23 Jul 2015 02:39 PM
BUMP
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
23 Jul 2015 02:50 PM
BUMP
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
23 Jul 2015 02:52 PM
Idk, make sure the minion's name is "Worker," also if there are multiple minions then you're only finding one of them.

u sicko!
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
23 Jul 2015 03:01 PM
yeah but it why I'm trying to ask how I could find all of them and use one of them selectivily with their master value.
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
23 Jul 2015 03:15 PM
Here's an example of getting the minions and doing something with them:

local Minions = game.Workspace.Minions:GetChildren() --Minions is a model and the player's are the model's children, which means the players are inside of the model.

for i,v in pairs (Minions) do
--v is each child of Minions.
if v.Torso then
--Code!!!!!!!
end
end

Also read:
wiki.roblox.com/index.php?title=GetChildren
wiki.roblox.com/index.php?title=Pairs#pairs

u sicko!
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
23 Jul 2015 06:05 PM
Could you explain me how pairs work please O_o . I've read the forum topic and I can't get it. I want to make that if a minion touch a tree it will remove the tree and give +1 wood in a value that the owner of the minion have.
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
23 Jul 2015 06:56 PM
BUMP
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