Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How to make it stop spinning at a certain time?

Asked by 2 years ago

Hello. If you have recently seen my other problem you might know I had a problem with having to click something every time for it to move, I have solved the clicking part. But now how do I make it stop at a certain time? here is my script:

script.Parent.ClickDetector.MouseClick:connect(function()

while true do
    game.Workspace.Dav:SetPrimaryPartCFrame(game.Workspace.Dav.MainPart.CFrame * CFrame.fromEulerAnglesXYZ(0.001,0,0))
    wait()
end

end)

1 answer

Log in to vote
0
Answered by
hellmatic 1502 Moderation Voter
2 years ago
Edited 2 years ago
local CanSpin = true 
local Seconds = 4

script.Parent.ClickDetector.MouseClick:connect(function()

spawn(function()
    while true do
        if CanSpin then 
            game.Workspace.Dav:SetPrimaryPartCFrame(game.Workspace.Dav.MainPart.CFrame * CFrame.fromEulerAnglesXYZ(0.001,0,0))

        elseif not CanSpin then 
            print('stop')
            break
        end
    wait()
    end
end)


end)

wait(Seconds)
CanSpin = false 
0
This crashes my game. Also there is a click detector in there too. JadonFrenzy 15 — 2y
0
rip RodrigatorOP 172 — 2y
0
Fixed hellmatic 1502 — 2y
Ad

Answer this question