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

Help with growing part (ClickDetectors)?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

When I click a part, I want a part's size to grow until the size reaches 20,20,20. (JUTS KEEPS GROWING).

Also, when I click on the part, the gui does not pop up.

game.Players.PlayerAdded:connect(function(plr)
    d = true

    script.Parent.ClickDetector.MouseClick:connect(function()
        if d == true then
            d = false

            while true do
                local X = script.Parent.Parent.Parent.Block.Part.Size.X
                local Y = script.Parent.Parent.Parent.Block.Part.Size.Y
                local Z = script.Parent.Parent.Parent.Block.Part.Size.Z
                script.Parent.Parent.Parent.Block.Part.Size = Vector3.new(X+.1,Y+.1,Z+.1)
                wait()
                if script.Parent.Parent.Parent.Block.Part.Size = Vector3.new(20,20,20) then
                    break
                end
            end 

            local Gui = script.Parent.Gui
            Gui:Clone().Parent = plr.PlayerGui
            wait(2)
            plr.PlayerGui.Gui:remove()
            d = true
        end
    end)
end)

1 answer

Log in to vote
1
Answered by 8 years ago

For the part to grow to 20 in all the axis in size it's:


local sp = script.Parent -- Get the part. local click = Instance.new("ClickDetector", sp) -- Create and parent the ClickDetector sp.ClickDetector.MouseClick:connect(function() -- Event MouseClick for the ClickDetector for i = 1,20, 0.01 do -- A simple for i loop that goes from 1 to 20 with 0.01 jumps. wait() -- Put a wait, for the loop to count smoothly from 1 - 20. sp.Size = Vector3.new(i, i, i) -- Just replace the XYZ with the i which is 1-20 with 0.01's. end end)
Ad

Answer this question