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: Weird Bug with Key Script

Previous Thread :: Next Thread 
SomeTrollingGuy90 is not online. SomeTrollingGuy90
Joined: 12 Mar 2010
Total Posts: 6539
08 Apr 2015 09:10 PM
Hi. I made a Key Script that's supposed to unAnchor a Door connected with it inside the Script's Code. However, If you touch anything with the key it will Unanchor the part you touch is connected to.

Any possible fixes?

Full Script :

script.Parent.Handle.Touched:connect(function(part)
local Door = workspace.Door
local Activator = Door.Knob
if Activator and Activator.Parent then
if Activator.Parent.Name == "Door" and Activator.Name == "Knob" then
local doorParts = part.Parent:GetChildren()
for i=1, #doorParts do
if doorParts[i].Anchored == true then
doorParts[i].Anchored = false
Door.SFUnlock:Play()
end
end
end
script.Parent:Destroy()
end
end)
Report Abuse
SomeTrollingGuy90 is not online. SomeTrollingGuy90
Joined: 12 Mar 2010
Total Posts: 6539
08 Apr 2015 10:13 PM
Maybe I should make the top half a seperate function.
Report Abuse
iHin is not online. iHin
Joined: 06 Apr 2014
Total Posts: 407
08 Apr 2015 10:17 PM
1. "workspace" is deprecated: consider changing.

2. To check if the Activator and Parent exist use "findFirstChild()"

3. Be sure to put a "wait()" with your for function.
Report Abuse
SomeTrollingGuy90 is not online. SomeTrollingGuy90
Joined: 12 Mar 2010
Total Posts: 6539
08 Apr 2015 10:24 PM
^ Thanks!
Report Abuse
SomeTrollingGuy90 is not online. SomeTrollingGuy90
Joined: 12 Mar 2010
Total Posts: 6539
08 Apr 2015 10:29 PM
Can you provide an Example of how I would insert those recommendations into the Script Code?
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