generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Unanchored on Touch

Previous Thread :: Next Thread 
KAMIKAZEPOLO is not online. KAMIKAZEPOLO
Joined: 14 Mar 2012
Total Posts: 1049
27 Jul 2015 08:08 PM
function KillAnchored(hit)
if hit:FindFirstChild("Safe") then
elseif hit:IsA("Part") then
hit.Anchored = false
end
end

script.Parent.Touched:connect(KillAnchored)

This script is suppose to unanchored parts on touch, however it doesn't work. This time the script isn't disabled.

Also, if this part touched another part in a group would it not work?
Report Abuse
guymanforget is not online. guymanforget
Joined: 21 Aug 2013
Total Posts: 57
27 Jul 2015 08:21 PM
Test if it is touched then in the function type in "script.Parent.Anchored = false"
Thanks for listening it should go something like:

function onTouch(part)
script.Parent.Anchored = false
end
script.Parent.Touched:connect(onTouch)
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
27 Jul 2015 08:23 PM
if hit:FindFirstChild("Safe") then
elseif hit:IsA("Part") then
hit.Anchored = false
end

--That is unnecessary,

if not hit:FindFirstChild'Safe'and hit:IsA'Part'then
hit.Anchored = false
end
Report Abuse
KAMIKAZEPOLO is not online. KAMIKAZEPOLO
Joined: 14 Mar 2012
Total Posts: 1049
27 Jul 2015 08:39 PM
Thanks for the replies.

@cgn you can write :FindFirstChild with '' instead of ("")?

also, it didn't seem to work for some reason, although it's probably how I structured my 'safe' thing that messed it up.
Report Abuse
KAMIKAZEPOLO is not online. KAMIKAZEPOLO
Joined: 14 Mar 2012
Total Posts: 1049
27 Jul 2015 08:59 PM
Even with the replies, this script doesn't work.
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
27 Jul 2015 09:13 PM
First of all, where is this script located?
Also, do you want to unanchor ANY part that you touch?
Report Abuse
KAMIKAZEPOLO is not online. KAMIKAZEPOLO
Joined: 14 Mar 2012
Total Posts: 1049
27 Jul 2015 10:13 PM
This script is located inside a union, and no, there is a number value inside parts I don't want to be unachored called "Safe".
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
27 Jul 2015 10:15 PM
local p = script.Parent

p.Touched:connect(function(hit)
local parent= hit.Parent
if parent and not parent:FindFirstChild("Safe") then
hit.Anchored = false
end
end)
Report Abuse
KAMIKAZEPOLO is not online. KAMIKAZEPOLO
Joined: 14 Mar 2012
Total Posts: 1049
27 Jul 2015 10:22 PM
@insta thanks for replying, but the parts were still anchored after being touched by the part.

Here's a bit more information, the parts that are being touched are in a model titled "Map1". There's one part in "Map1" with the safe numbervalue in it, that part is called "BasePlate".
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
27 Jul 2015 10:27 PM
wait, is the safe value inside of the brick?
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
27 Jul 2015 10:28 PM
if so, simply do this:

local p = script.Parent

p.Touched:connect(function(hit)
if hit.Parent and not hit:FindFirstChild("Safe") then
hit.Anchored = false
end
end)
Report Abuse
KAMIKAZEPOLO is not online. KAMIKAZEPOLO
Joined: 14 Mar 2012
Total Posts: 1049
27 Jul 2015 10:37 PM
This time it didn't work either. However, I left out one part. The part is being C-Framed when this script is ran, so maybe that's the issue?
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
27 Jul 2015 10:41 PM
..
dear lordy

you see, when you adjust the cframe of an object, and it happens to collide with another, .Touched isn't fired

so yes, it would have helped if you told us that a while ago
Report Abuse
KAMIKAZEPOLO is not online. KAMIKAZEPOLO
Joined: 14 Mar 2012
Total Posts: 1049
27 Jul 2015 10:43 PM
Sorry, I'm not the most technical scripter. Yes, you're right I should have told you that from beginning. Is there a way I could make it detect, however?
Report Abuse
KAMIKAZEPOLO is not online. KAMIKAZEPOLO
Joined: 14 Mar 2012
Total Posts: 1049
27 Jul 2015 10:46 PM
@insta you're post count tho lol
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image