I am completely stuck on this, and have nowhere to start. Please help!!!!
Anchored property
The Anchored
property returns a configurable boolean value that toggles physics reactions to a base part. Because this property is boolean, you can only work with true
or false
values. You can think of these values like true = on, false = off or true = checked, false = unchecked, either way you look at it, they're the exact opposite of eachother.
Anyway, we can index an object for this property just as we do with any other property, using the .
symbol. This symbol is used to index tables
for their values.
Events
Now events are a bit more complicated relative to properties. You'll need to know a bit about how functions work before trying to understand them. I recommend this wiki page on functions if you don't understand them that well: http://wiki.roblox.com/index.php?title=Function
Result
Keep in mind that we also index objects for their events the same way we do with their properties. So to access the Touched
event (which is the one you're looking for), we'd simply just say something like Object.Touched
However, like I said before, events are a bit more complicated than regular properties. They will involve functions, and connecting them to the event. (We actually use the connect
method on the event to do this)
So, here would be our final result:
-- 'Object' in this example would reference a part in the workspace named 'Baseplate' local Object = workspace.Baseplate -- Notice how I use the 'connect' method on the event, and pass a function as it's argument. This means the code inside this function will run whenever this part is touched. Object.Touched:connect(function(Part) Part.Anchored = true -- Freeze the part end)
Hope this helped, let me know if you have any questions.
ScriptingHelpers is not a request site, but I will give you this one because it is very simple.
First, lets say you have a brick in your Workspace, and its name is 'Bricky'.
Parts in ROBLOX have a Property called Anchored, and you can access it from a script using a . (dot) between the Part and the Property. We also need to use a connector.
brick = workspace.Bricky Bricky.Touched:connect(function() Bricky.Anchored = false end)
That should solve it. If you need any more help, comment on this answer.