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 » Scripting Helpers
Home Search
 

Re: "Put into" how?

Previous Thread :: Next Thread 
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 09:10 PM
function OnTouched(hit)
if game.Workspace.player.Torso.MeshID == ("Mesh ID goes in here") then
a = game.Workspace.Lighting:FindFirstChild("Weapon goes here")clone()
a.Parent ?????
How do i make the weapon go into the players backpack?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
23 Oct 2011 09:14 PM
game.Players.PlayerAdded:connect(function(Player)
--Say the weapon is in lighting
game.Lighting.Sword.Parent = Player.Backpack
end)
Report Abuse
LocalDimensions is not online. LocalDimensions
Joined: 08 Oct 2011
Total Posts: 2929
23 Oct 2011 09:15 PM
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if human ~= nil then
local name = human.Parent:lower() -- script most likely doesn't work, just streaking on current knowledge at this point
local wep = game.Lighting:findFirstChild("Weapon"):Clone()
wep.Parent = game.Players.name.Backpack
else
return false
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
LocalDimensions is not online. LocalDimensions
Joined: 08 Oct 2011
Total Posts: 2929
23 Oct 2011 09:16 PM
@Miz

I think he wants it so when the player touches the brick it gives him the tool.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
23 Oct 2011 09:17 PM
-__-

I made that like a month ago. But that's not the script :)
Report Abuse
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 09:19 PM
Could i post it like this?
function OnTouched(hit)
if game.Workspace.Player.Torso.MeshID == ("Blahbady blah") then
a = game.Workspace.Lighting:FindFirstChild("Sword")clone()
a.Parent = Parent.Backpack

Im kinda new to scripting, but mostly where to put things.
Report Abuse
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 09:21 PM
Here's the whole script:

function onTouch(hit)
if hit.Parent.Torso.MeshId == ("37152069") then -- Put the link in the quotes
a = game.Lighting:FindFirstChild("Cursed Mummy friend"):clone()
a.Parent = hit.Parent --RIGHT HERE IS WHERE I'M CONFUSED.
b = game.Lighting:FindFirstChild("Khopesh"):clone()
b.Parent = hit.Parent --SAME WITH HERE AND THE OTHER ONES LIKE THIS.
elseif hit.Parent.Torso.MeshId == ("27112438") then
c = game.Lighting:FindFirstChild("LinkedDagger"):clone()
c.Parent = hit.Parent
elseif hit.Parent.Torso.MeshId == ("32332055") then
d = game.Lighting:FindFirstChild("Gunslinger Rifle"):clone()
d.Parent = hit.Parent
elseif hit.Parent.Torso.MeshId == ("32336368") then
e = game.Lighting:FindFirstChild("Fly"):clone()
e.Parent = hit.Parent
f = game.Lighting:FindFirstChild("Punch"):clone()
f.Parent = hit.Parent
elseif hit.Parent.Torso.MeshId == ("27123973") then
g = game.Lighting:FindFirstChild("Blaster Pistol"):clone()
g.Parent = hit.Parent
h = game.Lighting:FindFirstChild("Lightsaber"):clone()
h.Parent = hit.Parent
elseif hit.Parent.Torso.MeshId == ("32332055") then
i = game.Lighting:FindFirstChild("LinkedSword"):clone()
i.Parent = hit.Parent
elseif hit.Parent.Torso.MeshId == ("55717536") then
j = game.Lighting:FindFirstChild("Pistol"):clone()
j.Parent = hit.Parent
k = game.Lighting:FindFirstChild("JetPack"):clone()
k.Parent = hit.Parent
end
end
print("It worked!")
script.Parent.Touched:connect(onTouch)
Report Abuse
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
23 Oct 2011 10:12 PM
Anyone?
Report Abuse
palk47 is not online. palk47
Joined: 07 May 2009
Total Posts: 508
23 Oct 2011 10:35 PM
Ok here,

function OnTouched(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
if hit.Parent.Torso.MeshID == "Mesh ID goes in here" then
a = game.Workspace.Lighting:FindFirstChild:("Weapon goes here"):clone()
player = Players:GetPlayerFromCharacter(hit.Parent)
a.Parent = player.Backpack
end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
palk47 is not online. palk47
Joined: 07 May 2009
Total Posts: 508
23 Oct 2011 10:36 PM
Whoops, try this,

function OnTouched(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
if hit.Parent.Torso.MeshID == "Mesh ID goes in here" then
a = game.Workspace.Lighting:FindFirstChild:("Weapon goes here")
b = a:clone()
player = Players:GetPlayerFromCharacter(hit.Parent)
b.Parent = player.Backpack
end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
wow75 is not online. wow75
Joined: 16 Jan 2009
Total Posts: 951
26 Oct 2011 10:30 PM
Now how can i do that while adding the other 45 package mesh IDs?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
27 Oct 2011 04:59 PM
a.Parent = hit.Parent --RIGHT HERE IS WHERE I'M CONFUSED.

I'm not sure if anyone answered this already but let me explain

1. I would use anonymous function

game.Workspace.Part.Touched:connect(function(hit)
--variable for a
if a.Parent = hit.Parent
a.Parent = hit.Parent.... There the same things, that's why the if then statement is running


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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