How do i run a script with a clickdetector button?
I am assuming you are decently new to Roblox Lua Scripting. So I am going to give you just some ideas of what you will need, and you can find it on the wiki! A good way to make a clickbutton run a script, is creating a function You put what you want to happen inside the function, and then you call the script with an event. You can find events in the Object Browser. However if you wanted to make it so when the block is clicked you would use
function NameFunction (What you want to happen) end
This function is not done yet, you need to call the function. In order to do that, you can use an event/listener. There are many events or listeners in the object browser. They can be found as the little yellow lightning symbol. In this instance, you will go inside the ClickDetector and call the MouseClick listener. Like so:
game.Workspace.Part.ClickDetector.MouseClick:connect(NameFunction)
Anyways, there are a lot of things you can do with functions, with many events and listeners to use from! Whether it's making a slot machine, boat, planes, anything you want! Happy scripting, hope this helped! I can't exactly make the script for you, as it is against the rules. However, for all of your scripting needs, go to the wiki before coming here. If you can't find anything on the wiki then come here. :)