I'm trying to make a tube from the hunger games but it rises before clicked and doesn't stop after the set time.
local active = false if workspace.Clickmebutton.ClickDetector.MouseClick then active = true end if active == true then local brick=script.Parent while wait(0) do brick.CFrame=brick.CFrame+Vector3.new(0,.133,0) wait() end wait(37.3) script:Destroy() end
I'm kind of a noob so please go easy on me!
That's not a functional connect event.
Use the TweenService to tween the part to a position rather than attempting to do it through a loop.
Replace x
, y
and z
with the values of the new position.
local tweenService = game:GetService("TweenService") local clickDetector = workspace:WaitForChild("Clickmebutton").ClickDetector local seconds = 10 clickDetector.MouseClick:Connect(function() tweenService:Create(script.Parent, TweenInfo.new(seconds, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = CFrame.new(x, y, z}):Play() end)