简体   繁体   English

循环帮助 (roblox)

[英]Loop help (roblox)

I have a problem with this script:我有这个脚本的问题:

local plight = script.Parent.Bulb.PointLight
local slight = script.Parent.Bulb.SpotLight
local rotatingPart = script.Parent.Bulb

local reader = script.Parent.Parent["card-reader1a"].reader1a.ProximityPrompt
local c = 0
local cc = 0

local tweenService = game:GetService("TweenService")
local tInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false)

local function rotating()
    if c == 0 then
        c = 1
        local play1 = tweenService:Create(rotatingPart, tInfo, {CFrame = rotatingPart.CFrame * CFrame.Angles(0, math.rad(120), 0)})
        play1:Play()
        play1.Completed:Connect(rotating)
        c = 0
    end
end

reader.Triggered:Connect(rotating)

I have infinitive loop and I don't know how to stop it.我有不定式循环,我不知道如何停止它。 I tried many methods and nothing worked.我尝试了很多方法,但没有任何效果。 Can someone help?有人可以帮忙吗?

Try removing play1.completed:Connect(rotating)尝试删除play1.completed:Connect(rotating)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM