|
| 15 Jul 2014 07:57 PM |
Im creating a script where when someone click on a certain part, that part will move.
Heres my current script
while true do wait() if findIfClose(game.Workspace) then for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(0.2,0,0) end wait(2) for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(-0.2,0,0) end wait(0.5) end end |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2014 08:03 PM |
Edited part
onclick() do if findIfClose(game.Workspace) then for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(0.2,0,0) end wait(2) for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(-0.2,0,0) end wait(0.5) end end |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2014 08:15 PM |
I did this script I created and it still doesn't work.
function onClicked() if findIfClose(game.Workspace) then for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(0.2,0,0) end wait(2) for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(-0.2,0,0) end wait(0.5) end end
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2014 08:20 PM |
Okay, now I tried it with that shows all the parts separate.
function onClicked() if findIfClose(game.Workspace) then for i=1,40 do wait() script.Parent.Door.CFrame = script.Parent.Door.CFrame + Vector3.new(0.2,0,0) script.Parent.Handle.CFrame = script.Parent.Handle.CFrame + Vector3.new(0.2,0,0) script.Parent.Lock.CFrame = script.Parent.Lock.CFrame + Vector3.new(0.2,0,0) end wait(2) for i=1,40 do wait() script.Parent.Door.CFrame = script.Parent.Door.CFrame + Vector3.new(-0.2,0,0) script.Parent.Handle.CFrame = script.Parent.Handle.CFrame + Vector3.new(-0.2,0,0) script.Parent.Lock.CFrame = script.Parent.Lock.CFrame + Vector3.new(-0.2,0,0) end wait(0.5) end end
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 15 Jul 2014 08:23 PM |
local what = script.parent
local click = Instance.new("ClickDetector") click.Parent = what
click.MouseClick:connect(function() if findIfClose(game.Workspace) then for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(0.2,0,0) end wait(2) for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(-0.2,0,0) end wait(0.5) end end end)
This 'fix' may work. Sorry if it doesn't... Because I didn't read through your code- sorry :/ |
|
|
| Report Abuse |
|
|
| |
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 15 Jul 2014 08:30 PM |
this may work,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ local move = script.Parent
local click = Instance.new("ClickDetector") click.Parent = move
click.MouseClick:connect(function() if findIfClose(game.Workspace) then for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(0.2,0,0) end wait(2) for i=1,40 do wait() script.Parent.DoorParts.CFrame = script.Parent.DoorParts.CFrame + Vector3.new(-0.2,0,0) end wait(0.5) end end) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2014 08:30 PM |
script.parent is not script.Parent
capitilization |
|
|
| Report Abuse |
|
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 15 Jul 2014 08:30 PM |
| I can't really test the script because I don't have the whole deal. I don't have "DoorParts" in my workspace. Maybe try my new code. |
|
|
| Report Abuse |
|
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
|
| 15 Jul 2014 08:31 PM |
Yes, I fixed that, as you can see :P
And the first one was fixing your onClick function or whatev. You did it weird :P |
|
|
| Report Abuse |
|
|
| |
|
blox6137
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 1109 |
|
| |
|
|
| 15 Jul 2014 08:39 PM |
| What script is the correct one? |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2014 08:41 PM |
| lolol if findIfClose(game.Workspace) then wtf is findIfClose |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2014 08:43 PM |
| It finds if the door is closed. |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Jul 2014 02:39 AM |
bump
Im pretty sure that my script was almost right, but it still no work. :( |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2014 03:02 AM |
| Okay, so I finally got it where when you click it, it will open. But it will not take the other two parts with it. I tried putting the two parts inside the main part. Still nothing. How would I get the script to notice that the other two parts are a parent with the main parent? |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2014 03:16 AM |
| Never mind, I soon found out that I could weld them together. Thanks for the help you guys gave me. Thread closed. xD |
|
|
| Report Abuse |
|
|