Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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?

5 comments

0

Any errors in the output?

0

Nope...

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..

0

How do I fix that then...

0

Do you have FilteringEnabled on?

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.