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: OnClick Decal Changer

Previous Thread :: Next Thread 
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
30 Jul 2014 02:35 PM
Is there a script in which I can click a button and it'll change the decal on another brick?
Report Abuse
Kilometerz is not online. Kilometerz
Joined: 20 Sep 2012
Total Posts: 2666
30 Jul 2014 02:38 PM
function onClicked()
wait()
game.Workspace.PartName.Decal.Texture = ""
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
30 Jul 2014 02:42 PM
Thanks, I'll try it out when I can access Studio.
Report Abuse
Kilometerz is not online. Kilometerz
Joined: 20 Sep 2012
Total Posts: 2666
30 Jul 2014 02:44 PM
Also don't forget to get a decals texture to subtract one from its ID.
Report Abuse
fret13103 is not online. fret13103
Joined: 15 Mar 2010
Total Posts: 881
30 Jul 2014 02:44 PM
Or group the button and the part with the decal, so that you can copy paste it.

function onClicked()
wait()
script.Parent.Parent.PartName.Decal.Texture = ""
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
30 Jul 2014 02:47 PM
So I've got to group the decal brick and the button together along with using the Decal Images to have it run properly?
Report Abuse
Kilometerz is not online. Kilometerz
Joined: 20 Sep 2012
Total Posts: 2666
30 Jul 2014 02:47 PM
No I guess hes just trying to make it easier.
Report Abuse
fret13103 is not online. fret13103
Joined: 15 Mar 2010
Total Posts: 881
30 Jul 2014 02:52 PM
Yh, I'm just making it easier, so now you can spam the model, for example you can have a house with 2 of the "tv's" that change decal now. :)
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Jul 2014 02:59 PM
local textures = {
33140055;
137580687;
62923964;
}

local texture = 1
script.Parent.ClickDetector.MouseClick:connect(function()
script.Parent.Decal.Texture = "http://roblox.com/asset/?id=" .. tostring(textures[texture])
texture = (texture ~= #textures and texture + 1 or 1)
end)
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
30 Jul 2014 03:25 PM
That'll actually help. I'm using ir for Lockdown Doors and I'm gonna have a few, so being able to have more in the same Workspace would be good,
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
30 Jul 2014 03:27 PM
128, it looks like your script is able to flip through 3 decals instead of one. That might come in handy actually.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Jul 2014 03:40 PM
It'll actually flip through as many as you add to the list lol
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
30 Jul 2014 03:42 PM
That's pretty neat. Also, how do I loop it so that the decal can change back and forth?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Jul 2014 03:42 PM
What do you mean
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
30 Jul 2014 04:00 PM
When I click the button with the single decal script, it works but I can't change it back to the other decal if I click it again.
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
30 Jul 2014 04:06 PM
Also, is there a way I can hook it up to two bricks? That way I only need one button to change the decal on two separate bricks.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Jul 2014 04:26 PM
First question; I still don't understand what you mean

Second; Yes but Im on my phone right now, Im sure someone else can make it for you
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
30 Jul 2014 05:29 PM
When I click the button, it changes the decal on the brick like it should. When I click the button again it does not change the decal back and is stuck on the decal that it changed to when I clicked the button.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Jul 2014 10:09 PM
Right now it'll pick
decal1
decal2
decal3
decal1
decal2
decal3
repeat
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
30 Jul 2014 10:17 PM
128GB he means like:

Starts at decal 1
Click!
Becomes decal 2
Click!
Back to decal 1
etc
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Jul 2014 10:30 PM
Then only add 2 decals?

It'll go
decal1
decal2
decal1
decal2
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
31 Jul 2014 09:59 AM
So would I copy the line of the script with a new decal ID? How would I make it a loop though so I can click it any amount of times and it'll always change back and forth without stopping?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
31 Jul 2014 11:36 AM
Its already like that...
Report Abuse
G0LDENLUIGI is not online. G0LDENLUIGI
Joined: 18 Jul 2010
Total Posts: 4439
31 Jul 2014 04:53 PM
Well I've decided to start of with this script:

function onClicked()
wait()
script.Parent.Parent.PartName.Decal.Texture = ""
end
script.Parent.ClickDetector.MouseClick:connect(onClicked

It only works once.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
31 Jul 2014 05:43 PM
Mine works, I tried it before I posted it.
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