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

Baseplate toggle rotation problems. Any ideas?

Asked by 4 years ago
Edited 4 years ago

Hello! I have been trying to create a script that makes my baseplate flip after a random time. I was finally able to get it to work, however, but recently I added two buttons and a sign. The buttons are supposed to be a stop baseplate rotation and resume baseplate rotation (because my players were getting annoyed that they couldn't turn it off). The sign displays whether the baseplate is rotating or not. I have gotten the buttons to turn my variable "go" to true or false (that is the variable that is supposed to tell the script whether the baseplate can rotate or not) and I have gotten the sign to display what I wanted it to. Unfortunately, the baseplate never rotates whether the varible is set to true or false (yes it does actually change the variable)(it is set to true by default). Hope someone can help. Here's my code:

local yes = 0
local rotCount = 0
local go = true
local label = script.Parent.surface.SurfaceGui.TextLabel


-- button scripts

    script.Parent.STOP.ClickDetector.MouseClick:Connect(function() go = false
        print(go)
        label.Text = "Baseplate is not spinning."
        end)
    script.Parent.GO.ClickDetector.MouseClick:Connect(function() go = true
        print(go)
        label.Text = "Baseplate is spinning."
        end)

-- baseplate flip scripts


    for i=yes, 0,-1 do
        if go == true then
            script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,.01)
            wait(.0000001)
            yes = yes - 1   
        end 
    end

    if yes == 0 then
        wait(math.random(45,313))
        yes = yes + 314
        rotCount = rotCount + 1
        game.Workspace.Counter.holo.SurfaceGui1.Frame.CHANGEME.Text = rotCount
        game.Workspace.Counter.holo.SurfaceGui2.Frame.CHANGEME.Text = rotCount
        print(rotCount)
    end

0
If anything is unclear, please let me know! TheUltimateRealDude1 -9 — 4y
0
edit:- fixed codeblock User#5423 17 — 4y
0
@kingdom05 ok i see the rotation gif. thats looks good. however, i need it to wait random between 47 seconds and 313 seconds (just something random). TheUltimateRealDude1 -9 — 4y

Answer this question