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

Why can this script only click once and the model disappears and reappears itself?!

Asked by 7 years ago
Edited 7 years ago

I am making a Bug Catcher game where when you catch the bugs you click them then every 0.2 seconds its transparency goes down 0.1 so I added in the script to disable the other scripts while its transparency = 1 but the script repeats and all, but you can't click it again it just disappears after the first time?! help!

function onClicked()
    wait(0.2)
    script.Parent.Transparency = 0.1
    wait(0.2)
    script.Parent.Transparency = 0.2
    wait(0.2)
    script.Parent.Transparency = 0.3
    wait(0.2)
    script.Parent.Transparency = 0.4
    wait(0.2)
    script.Parent.Transparency = 0.5
    wait(0.2)
    script.Parent.Transparency = 0.6
    wait(0.2)
    script.Parent.Transparency = 0.7
    wait(0.2)
    script.Parent.Transparency = 0.8
    wait(0.2)
    script.Parent.Transparency = 0.9
    wait(0.2)
    script.Parent.Transparency = 1
    wait(0.1)
    game.Workspace.Beetle1.Move.Disabled = true
    game.Workspace.Beetle1.Kill.Disabled = true
    game.Workspace.Beetle1.ClickDetector.MaxActivationDistance = 0
    wait(5)
    script.Parent.Transparency = 0
    game.Workspace.Beetle1.Move.Disabled = false
    game.Workspace.Beetle1.Kill.Disabled = false
    game.Workspace.Beetle1.ClickDetector.MaxActivationDistance = 10
end
  script.Parent.ClickDetector.MouseClick:connect(onClicked)

other scripts below to match this!

Killing Script:

function onTouched(hit)
    if not hit or not hit.Parent then return end
    local human = hit.Parent:findFirstChild("Humanoid")
    if human and human:IsA("Humanoid") then
        wait(1)
        human:TakeDamage(5)
    end
end

script.Parent.Touched:connect(onTouched)

Moving Script:

while true do
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.07, 0.5, 20.895))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.07, 0.5, 20.065))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.07, 0.5, 19.155))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.91, 0.5, 19.155))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.91, 0.5, 19.745))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.91, 0.5, 19.745))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.07, 0.5, 20.065))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.07, 0.5, 19.155))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.91, 0.5, 19.155))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.91, 0.5, 19.745))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.07, 0.5, 20.895))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.07, 0.5, 20.065))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.07, 0.5, 19.155))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.91, 0.5, 19.155))
    wait(0.3)
    script.Parent.CFrame = CFrame.new(Vector3.new(1.91, 0.5, 19.745))
end

Answer this question