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

What is a script to restart an action?

Asked by 8 years ago

Can you help me? When a user throws a ball at a dunk tank, what is the script to reset the dunk tank?

0
Share more details please. XToonLinkX123 580 — 8y
0
In part of a game, the user will throw a ball at a free model dunk tank, when they throw the ball and hit the target, what is a script to put the thing they dunked back on the platform? RobloxGamesKing 0 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

I do not know what the object being dunked is. I will assume it's a part called "Partt" (Creative right?).

So, there are multiple way to do this but assuming you do not understand the scripting of your dunk tank because it is not yours, I will show you another way. This way is very simple and we will be using the touched event.

I will describe how I view the hierarchy here because you do not show where things are located so just check my code and this description. I am assuming their is a regular part that will be dunked and that part is named Partt and its inside of the model Dunking Tank. I assume to find the tank, you would go Workspace to a model named Dunking Tank that has all its parts inside and one of those parts are called water, where the object falls and ends up touching. This script will also be located in Water. Now for what you care about, the scripting!

  • The scripting
db = false
script.Parent.Touched:connect(function(hit)
        if db == false then db = true 
                if hit.Name == "Partt" then
                        wait(5) -- will not spawn until 5 seconds are up
                        script.Parent.Parent.Part
                        local copy = game.ServerStorage.Partt:Clone()
                        copy.Parent = script.Parent.Parent
                        copy.CFrame = CFrame.new(0,5,0)
                end
        end
        db = false
end)
  • script information All the above script is doing is using a denounce so it activates once and you need a copy of the falling part in ServerStorage. The script removes the fallen part and clones a copy of it to the workspace then moved to position 0,5,0. You must change where the part appears and you can take the CFrame of a part in the model and add to the y axis or any. Such as the platform it falls off.

Hope this helps, I spent a long time on my iPod typing this

0
Although you are helping people, I don't think having to help someone who didn't bother trying to show their script issue should be replied to. Nickoakz 231 — 8y
Ad

Answer this question