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

Click Detector clicking won't work... How do I fix this?

Asked by 7 years ago

So I have 4 parts that are inside of each other with click detectors with the activation distance of 0. Then a user does something and activates this script.

local Jobs = script.Parent.Parent.Jobs

function Unlock(Card)
if Card.Name == "Card1" then
    Jobs.Job4.Transparency = 0
    Jobs.Job4.SurfaceGui.Enabled = true
    Jobs.Job4.ClickDetector.MaxActivationDistance = 32
    script.Parent.Job.Value = 1
    Card.Parent = game.Lighting
    Card.Anchored = true
    script.Parent.Parent.Screen.SurfaceGui.CurrentJob.Text = "Mechanic (COMING SOON)"
end

if Card.Name == "Card2" then
    Jobs.Job3.Transparency = 0
    Jobs.Job3.SurfaceGui.Enabled = true
    Jobs.Job3.ClickDetector.MaxActivationDistance = 32
    script.Parent.Job.Value = 2
    Card.Parent = game.Lighting
    Card.Anchored = true
    script.Parent.Parent.Screen.SurfaceGui.CurrentJob.Text = "Gormet Chef (COMING SOON)"
end

if Card.Name == "Card3" then
    Jobs.Job1.Transparency = 0
    Jobs.Job1.SurfaceGui.Enabled = true
    Jobs.Job1.ClickDetector.MaxActivationDistance = 32
    script.Parent.Job.Value = 3
    Card.Parent = game.Lighting
    Card.Anchored = true
    script.Parent.Parent.Screen.SurfaceGui.CurrentJob.Text = "Office Worker (NOT FINISHED)"
end

if Card.Name == "Card4" then
    Jobs.Job2.Transparency = 0
    Jobs.Job2.SurfaceGui.Enabled = true
    Jobs.Job2.ClickDetector.MaxActivationDistance = 32
    script.Parent.Job.Value = 4
    Card.Parent = game.Lighting
    Card.Anchored = true
    script.Parent.Parent.Screen.SurfaceGui.CurrentJob.Text = "Store Clerk (COMING SOON)"
end
    end
script.Parent.Touched:connect(Unlock)

Accept when on of the Jobs activation distances go to 32 it won't let me click on it. Only Job1 works the rest do now. And also only one has the activation of 32 once the script is ran. Anyways to solve this?

0
Any errors in the output? M39a9am3R 3210 — 7y
0
Nope... thebootsie123 160 — 7y
0
Wait.. It will let you click it although depending on the part you have to click it in a different spot.. Like the top of the part. Or the bottom of the part but facing a certain way.. thebootsie123 160 — 7y
0
How do I fix that then... thebootsie123 160 — 7y
0
Do you have FilteringEnabled on? AwsomeSpongebob 350 — 7y

1 answer

Log in to vote
-1
Answered by 7 years ago

Try adding a wait.

Ad

Answer this question