Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Is this blender script correct? Need help with this script.

Asked by 6 years ago

I would like to make item givers and stuff like in many cafe typed games. I can make item givers but I would like to make a Blender, something like;

Cup(item) -> Ice machine -> Blender.

I want the blender to take sometime and change the colour. This script doesn't work. How do I fix this.

function tch(h)
if (h.Parent.Name == "Anything") then -- Same thing ^^^^
h.Parent.Name = "Blending..." -- Not this one.
script.Parent.Sound:Play()
script.Parent.Parent.Part1.BrickColor = h.Parent.Handle.BrickColor
script.Parent.Parent.Part2.BrickColor = h.Parent.Handle.BrickColor
script.Parent.Parent.Part3.BrickColor = h.Parent.Handle.BrickColor
script.Parent.Parent.Part4.BrickColor = h.Parent.Handle.BrickColor
script.Parent.Parent.Part5.BrickColor = h.Parent.Handle.BrickColor
script.Parent.Parent.Part6.BrickColor = h.Parent.Handle.BrickColor
script.Parent.Parent.Part7.BrickColor = h.Parent.Handle.BrickColor
script.Parent.Parent.Part8.BrickColor = h.Parent.Handle.BrickColor
script.Parent.Parent.Part9.BrickColor = h.Parent.Handle.BrickColor
wait(0.1)
script.Parent.Parent.Part8.Transparency = 0
script.Parent.Parent.Part9.Transparency = 1
wait(0.1)
script.Parent.Parent.Part7.Transparency = 0
script.Parent.Parent.Part8.Transparency = 1
wait(0.1)
script.Parent.Parent.Part6.Transparency = 0
script.Parent.Parent.Part7.Transparency = 1
wait(0.1)
script.Parent.Parent.Part5.Transparency = 0
script.Parent.Parent.Part6.Transparency = 1
wait(0.1)
script.Parent.Parent.Part4.Transparency = 0
script.Parent.Parent.Part5.Transparency = 1
wait(0.1)
script.Parent.Parent.Part3.Transparency = 0
script.Parent.Parent.Part4.Transparency = 1
wait(0.1)
script.Parent.Parent.Part2.Transparency = 0
script.Parent.Parent.Part3.Transparency = 1
wait(0.1)
script.Parent.Parent.Part1.Transparency = 0
script.Parent.Parent.Part2.Transparency = 1
wait(0.1)
script.Parent.Blend:Play()
wait(4.5)
h.Parent.Name = "Pouring..."
script.Parent.Sound:Play()
wait(0.1)
script.Parent.Parent.Part1.Transparency = 0
wait(0.1)
script.Parent.Parent.Part2.Transparency = 0
script.Parent.Parent.Part1.Transparency = 1
wait(0.1)
script.Parent.Parent.Part3.Transparency = 0
script.Parent.Parent.Part2.Transparency = 1
wait(0.1)
script.Parent.Parent.Part4.Transparency = 0
script.Parent.Parent.Part3.Transparency = 1
wait(0.1)
script.Parent.Parent.Part5.Transparency = 0
script.Parent.Parent.Part4.Transparency = 1
wait(0.1)
script.Parent.Parent.Part6.Transparency = 0
script.Parent.Parent.Part5.Transparency = 1
wait(0.1)
script.Parent.Parent.Part7.Transparency = 0
script.Parent.Parent.Part6.Transparency = 1
wait(0.1)
script.Parent.Parent.Part8.Transparency = 0
script.Parent.Parent.Part7.Transparency = 1
wait(0.1)
script.Parent.Parent.Part9.Transparency = 0
script.Parent.Parent.Part8.Transparency = 1
wait(0.1)
script.Parent.Parent.Part9.Transparency = 1
h.Parent.Name = "Change to anything!" -- Anything
wait(0.5)
end
end

script.Parent.Touched:connect(tch)

Once I insert the cup or whatever, it's stuck at "blending" and wouldn't show any music or stuff... Please help.

Thank you.

0
Please explain me on how the above script works. Thank you. SW33TSTUFF 7 — 6y
0
Don't take this the wrong way but the above script looks pretty inefficient, try using for loops and tables to save space. EnderGamer358 79 — 6y
0
dont ask us to fix free models Gey4Jesus69 2705 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Simply add a debounce to lines 1,3 and 73:

Line 1:

bool = true

Line 3:

bool = false

Line 73:

bool = true

Because there is no debounce in your script, the function will continue to run as long as it is continuously called. Debounce stops the function after running once.

Ad

Answer this question