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: Button Script

Previous Thread :: Next Thread 
superdimensionmaster is not online. superdimensionmaster
Joined: 18 Jan 2008
Total Posts: 8387
26 Oct 2012 06:34 PM
I've tried to fix this several times but I haven't figured it out. Can anyone help?


function onClicked()
local model = game:GetService("InsertService"):LoadAsset(13844618)
if(model:IsA("Hat")) then
local tab = game:GetService("InsertService"):Insert(model)
model.Parent = script.Parent.Parent.Parent["Profile Character"].Appearance
end
end

function MouseOver()
script.Parent.Parent.MouseOverText.Text = script.Parent.Name
end

script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseEnter:connect(MouseOver)
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
26 Oct 2012 06:37 PM
I haven't worked with InsertService much (I very much dislike it), but this is my (probably wrong) theory, try it out.

When you insert something with InsertSerivce using LoadAsset it gives you a model, not the object. This means that you're checking if a model is a hat in line 3. Try this:

if model:GetChildren()[1]:IsA("Hat") then
Report Abuse
superdimensionmaster is not online. superdimensionmaster
Joined: 18 Jan 2008
Total Posts: 8387
26 Oct 2012 06:39 PM
I was trying to load a hat from the catalog. I'll try that. I used to dislike InsertService before I realized that it has a few places in my game that it would improve.
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