|
| 22 Nov 2014 08:40 PM |
function onClicked() if (script.Parent == onClicked) then game.Workspace.Spill.Transparency = 0 wait(2) game.Workspace.Spill.Transparency = 1 wait(0.3) game.Lighting.CoffeeCup:clone() if (game.LocalBackback.CoffeeCup.Name == "CoffeeCup") then game.LocalBackpack.CoffeeCup.Name = "Regular Coffee" end end end
script.Parent.MouseButton1Click:connect(onClicked)
I am trying to make a coffee machine with a click of a button, it gives you coffee/smoothies. You click the type of coffee you want, for example, Regular. When you click it, there is a spill that makes it look like it's coming out. Then it disappears (Transparency 1) and it automatically gives you the coffee WITH THE COFFEE NAME 'Regular".
Thank you, please Reply if you can fix this for me! |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 08:42 PM |
| localbackpack isnt even a thing... |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Nov 2014 08:51 PM |
@visual http://wiki.roblox.com/index.php?title=LocalBackpack |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 08:54 PM |
@UnConcerning
ty for your insights i never knew |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 08:57 PM |
I'm being serious. Just help me fix it, I'm waiting to become a good coder. I can help others make their stuff.
~ryguy |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 09:08 PM |
script.Parent.MouseButton1Down:connect(function'' workspace'Spill'.Transparency=0 wait(2) workspace'Spill'.Transparency=1 wait(.3) game.Lighting'CoffeeCup':clone'' game.Players.LocalPlayer:waitForChild'Backpack'.CoffeeCup.Name='Regular Coffee' end) |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 09:25 PM |
@UnCon It says that script.Parent.MouseButton1Down:connect(function'' doesn't work because of ''. |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Nov 2014 09:37 PM |
@UnConcerning
workspace'Spill'.Transparency=0
Doesn't work Lol. game.Workspace? or game.Workspace.Spill? |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 09:39 PM |
@UnCon
Nevermind I fixed that part, but it has trouble taking the coffee cup in lighting putting it into your inventory and renaming it. More like cloning trouble. |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 09:41 PM |
script.Parent.MouseButton1Down:connect(function'' workspace'Spill'.Transparency=0 wait(2) workspace'Spill'.Transparency=1 wait(.3) local nCup=game.Lighting'CoffeeCup':clone'' nCup.Parent=game.Players.LocalPlayer:waitForChild'Backpack' nCup.Name='Regular Coffee' end) |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 09:54 PM |
@UnCon
Do you even test the code your giving me? Because it isn't working. Especially from cloning the coffee cup into your backpack/inventory. |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 09:59 PM |
i dont test my code
script.Parent.MouseButton1Down:connect(function() workspace'Spill'.Transparency=0 wait(2) workspace'Spill'.Transparency=1 wait(.3) local nCup=game.Lighting'CoffeeCup':clone'' nCup.Parent=game.Players.LocalPlayer:waitForChild'Backpack' nCup.Name='Regular Coffee' end)
|
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 10:04 PM |
@UnCon
Dude just test you code. It's not working. For now, I'll listen to someone else to help me. |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 10:17 PM |
| my code is flawless, ur doing something wrong m8 |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 10:23 PM |
| Then go into studio make a surface gui, frame, TextButton, then a script with that code crap and make the spill. |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Nov 2014 10:38 PM |
debounce = false -- Debounce makes sure it isn't clicked and repeated multiple times script.Parent.MouseButton1Click:connect(function(p) -- This script needs to be a direct child of a ClickDetector if debounce == false then -- Check the debounce debounce = true -- The function cannot be used again until we are done doing what we want to do game.workspace.Spill.Transparency = 0 -- Is Spill a direct child of workspace? Make sure you have the right path. wait(2) game.workspace.Spill.Transparency = 1 -- I hope it is a direct child or this will error out. wait(.3) CoffeeCup = game.ReplicatedStorage.CoffeeCup:Clone() -- Don't use lighting for storage anymore, use -- ReplicatedStorage instead, that's the more effective way to do it now. CoffeeCup.Parent = p.Backpack -- Put it in the Player's backpack, I don't know what you were doing there CoffeeCup.name = "Regular Coffee" -- You don't really need to check, you just need to rename it debounce = false -- This function can now be used again end end)
Hope this helped, make sure you read the comments I made for you when you put it in your script. |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 10:41 PM |
@unconcering
last time I checked, you can't call workspace as a function
workspace'Spill'.Transparency = 1
^ how would that even work
try using brackets, bro |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2014 11:10 PM |
@C0mm
Thank you for the script, but it's still not working. I put the Coffee Cup into the ReplicatedStorage like you said in the comment. But, it never put it into my hot bar. Also, because of the debounce, I can't press the button again to try again. The Machine has a Buttonhole, so when you click it, it does the spill like it's coming out and it disappears and it automatically gives you a Coffee Cup with name "Regular Coffee" This isn't a part with ClickDetector.
Thank you, ~ryguy |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Nov 2014 03:12 PM |
I also tried this, but it didn't work either:
function onClicked() if (script.Parent.onClicked() == true) then game.Workspace.Spill.Transparency=0 wait(2) game.Workspace.Spill.Transparency=1 wait(.3) function hi(x) y = x.Backpack z = game.ReplicatedStorage["CoffeeCup"] z:Clone().Parent = y if (y.Parent.Name == "CoffeeCup") then y.Parent.Name = "Regular Coffee" end end end end
script.Parent.MouseButton1Down:connect(onClicked) script.Parent.MouseButton1Click:connect(hi)
Output said: 17:57:12.582 - Attempt to connect failed: Passed value is not a function 17:57:12.584 - Script 'Workspace.Clicker.SurfaceGui.Coffee.Regular.Script', Line 18 17:57:12.586 - Stack End |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Nov 2014 08:26 PM |
Do you have a function named "hi"?
Response to your response to my script:
If the script is not in a ClickDetector that is in the part, your script will not be able to tell that the function is supposed to be called and will likely error out because there is no event of "Part" or "BasePart" that is MouseButton1Down or MouseButton2Down.
Side Note: Maybe you just confused me with the phrasing of your comment and you meant that you have a SurfaceGui with a TextButton on the part that you are using to connect the function. If so then MouseButton1Click or MouseButton2Click would work. I wouldn't use MouseButton1Down for what you're doing. |
|
|
| Report Abuse |
|
|