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: Whats wrong?

Previous Thread :: Next Thread 
tyleralex123 is not online. tyleralex123
Joined: 01 Apr 2009
Total Posts: 19934
02 Jan 2012 09:57 AM
I have no idea whats wrong, there is no output!

texture = "http://www.roblox.com/asset/?id=63730951"

function giveGun(gun, player)
if player~=nil then
if game.Lighting:findFirstChild(gun) ~= nil then
if player.Backpack:findFirstChild(gun) == nil then
if player.Character:findFirstChild(gun) == nil then
cl = game.Lighting:findFirstChild(gun):clone()
cl.Parent = player.Backpack
end
end
end
end
end


function giveGunsOssimPeople(plyh)
if plyh~=nil then
p=texture
for i=1,#p do
if game.Player:GetPlayerFromCharacter(plyh).Torso.roblox.texture == true then
Sniper = game.Lighting.SUF:clone()
Sniper.Parent = player.Backpack -- Add more guns below this one
end
end
end
end

script.Parent.Touched:connect(giveGunsOssimPeople)
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
02 Jan 2012 10:03 AM
a) p=texture
for i=1,#p do

p is a string, not a table. You can't iterate through a string.

b) if game.Player:GetPlayerFromCharacter(plyh).Torso.roblox.texture == true then
errrr.... What?

c) function giveGun(gun, player)
if player~=nil then
if game.Lighting:findFirstChild(gun) ~= nil then
if player.Backpack:findFirstChild(gun) == nil then
if player.Character:findFirstChild(gun) == nil then
cl = game.Lighting:findFirstChild(gun):clone()
cl.Parent = player.Backpack
end
end
end
end
end

You never even call this function.

~THROW THE CHEEEEEEEEEEEEEEEEEEEESE!~
Report Abuse
DXPower is not online. DXPower
Joined: 21 Oct 2008
Total Posts: 2866
02 Jan 2012 10:05 AM




function giveGunsOssimPeople(hit)
if (hit.Parent:findFirstChild("Humanoid") ~=nil) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player~=nil then
local Sniper = game.Lighting.SUF:clone()
Sniper.Parent = player.Backpack -- Add more guns below this one
end
end
end
end

script.Parent.Touched:connect(giveGunsOssimPeople)
Report Abuse
tyleralex123 is not online. tyleralex123
Joined: 01 Apr 2009
Total Posts: 19934
02 Jan 2012 10:06 AM
All I want is a script that gives the player a certain gun if he is wearing a certain t-shirt.

Is that too hard?
Report Abuse
tyleralex123 is not online. tyleralex123
Joined: 01 Apr 2009
Total Posts: 19934
02 Jan 2012 10:08 AM
Where does the texture come in there DX
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
02 Jan 2012 10:10 AM
Working off DX's:

local texture = "whatever the texture was"

function giveGunsOssimPeople(hit)
if (hit.Parent:findFirstChild("Humanoid") ~=nil) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player~=nil then
if player.Character.Torso.roblox.Texture == texture then
local Sniper = game.Lighting.SUF:clone()
Sniper.Parent = player.Backpack -- Add more guns below this one
end
end
end
end
end

script.Parent.Touched:connect(giveGunsOssimPeople)

~THROW THE CHEEEEEEEEEEEEEEEEEEEESE!~
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
02 Jan 2012 10:12 AM
ohhh easy sorta

function onTouched(hit)
if game.Lighting:FindFirstChild:(gun) =~ nil and game.Players:FindFirstChild(hit.Parent.Name).BackPack:findFirstChild(gun) =~ nil and game.Workspace:FindFirstChild(hit.Parent.Name).""""""Idk bout this bit...""""".Texture == "Tshirt texture here" then
game.Lighting.Gun:clone().Parent = game.Players:FindFirstChild(hit.Parent.Name).Backpack
end
end

script.Parent.Touched:connect(onTouched)


Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
02 Jan 2012 10:12 AM
you might have to look in the output and fix mine a little bit ... :p
Report Abuse
tyleralex123 is not online. tyleralex123
Joined: 01 Apr 2009
Total Posts: 19934
02 Jan 2012 10:16 AM
I cant even read yours bob.

put some returns in there
Report Abuse
tyleralex123 is not online. tyleralex123
Joined: 01 Apr 2009
Total Posts: 19934
02 Jan 2012 10:19 AM
Jode,

Would I call the function of giveGun(gun, player) like this?


script.Parent.Touched:connect(giveGun) ?
Report Abuse
DXPower is not online. DXPower
Joined: 21 Oct 2008
Total Posts: 2866
02 Jan 2012 03:05 PM
Use a table full of textures, and make a for loop for each of the items in the table:

texture = {"Texture1","Texture2","Texture3"}

for i = 1, #texture do
if texture[i] == .....roblox.texture then

...

...
...
end

I didn't add the one function because I didn't know what it was doing, also, almost all your variables were wrong.
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