Help with a basic script

how come this script isnt working? there is a click detector in the button and im not sure what i need to add to make this work.

script.Parent.MouseButton1Down:Connect(function()
	script.Parent.Parent.pole1.Transparency = 0
	script.Parent.Parent.pole1.CanCollide = true
	wait(2)
	script.Parent.Parent.pole1.Transparency = 1
	script.Parent.Parent.pole1.CanCollide = false
end)
end)
1 Like

Maybe you need the :connect event.

Example: (insert variable here).Touched:connect(Clicked)

Maybe something like that, I don’t know I use it for my power up scripts :confused:

1 Like

I think your issue is with using ‘MouseButton1Down’ which isn’t an event of ClickDetector but is an event of Mouse.

Try this:

local clickDetector = script.Parent.ClickDetector

local function doStuff()
	print("Foo")
end

clickDetector.MouseClick:Connect(doStuff)

that didnt work for some reason

You have 2 ends

Remove 1 end and you’ll be good to go. Did you check your output?

Please check your output to debug.
There’s 2 end)'s in the script, remove 1.

They already have their event connected. “:connect” is deprecated while “:Connect” isn’t, their issue is that they have 2 ends

Try this:

script.Parent.MouseClick:Connect(function()

  --change pole transparency and cancollide here

end)

It should be inside of a ClickDetector.

alright thanks that should work

still didnt work any other suggestions for it to work

Is this script inside the ClickDetector or a Model?

its now inside the click detector

thanks for the help @08Boat i just made a new script listening to what you said and it now works

1 Like