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: Problem

Previous Thread :: Next Thread 
SapphireBuilding is not online. SapphireBuilding
Joined: 02 Jan 2015
Total Posts: 203
12 Jan 2015 11:22 PM
This script is supposed to check if there is a shirt in the person who clicks the GUI and if there isnt places one there and changes its template, if there is one it just changes its teamplate.

local player = script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid



function onButtonClicked()

check = player.Parent:FindFirstChild("Shirt")

if check == nil then
shirt = Instance.new("Shirt")
player.Parent.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=9261346"


else

player.Parent.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=9261346"
end



end

script.Parent.MouseButton1Click:connect(onButtonClicked)
Report Abuse
reptiledude10 is not online. reptiledude10
Joined: 16 Mar 2012
Total Posts: 29235
12 Jan 2015 11:23 PM
You never parented the shirt into the player in the first place. You just created one, which is now sitting in nil.




If life throws you lemons, then throw them back! If Chuck Norris throws you lemons, say, "Thank you!"
Report Abuse
SapphireBuilding is not online. SapphireBuilding
Joined: 02 Jan 2015
Total Posts: 203
12 Jan 2015 11:25 PM
It was one of the problems but didn't fix it.
Report Abuse
vacharya is not online. vacharya
Joined: 06 Jan 2011
Total Posts: 511
12 Jan 2015 11:30 PM
local player = script.Parent.Parent.Parent.Parent.Parent
function shirtcheck()
for _,v in pairs (player.Character:GetChildren()) do
if v.ClassName == "Shirt" then
v.ShirtTemplate = tostring("http://www.roblox.com/asset/?id=9261346") -- hmm tostring necessary? idk just stayin on the safe side
else
local newshirt = Instance.new("Shirt",player.Character)
newshirt.Name = "Shirt"
newshirt.ShirtTemplate = tostring("http://www.roblox.com/asset/?id=9261346")
end
end
end

script.Parent.MouseButton1Down:connect(shirtcheck)

:)
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