|
| 01 Sep 2016 06:20 AM |
Hi,
I'm coding for a door that 'opens' (invisible/can't collide) and 'closes' (visible/can collide) when clicked. I'm basing it on SkeleLordGamer's script on YouTube. However, when I'm testing it, it doesn't seem to open at all. Please could you help me? CLICK is an invisible brick where the door is which I want to be clicked to open and close the door. CLICK contains 'ClickDetector' and 'Script'. Part1 and Part2 are the parts of the door which should be changed when CLICK is clicked. CLICK, Part1 and Part2 are contained within in a group called 'DOOR'.
This is what the 'Script' contains: ___________________________
local Wood = true
local part1 = script.Parent.Parent.Part1
######################################################################################################### part1.CanCollide = true part2.Transparency = 0.3 part2.CanCollide = true end
local function off() Wood = false part1.Transparency = 1 part1.CanCollide = false part2.Transparency = 1 part2.CanCollide = false end
local function OnClicked() if Wood == true then off() else on() end end
script.Parent.ClickDetector.MouseClick:conncect (OnClicked) on() ________________________
Thanks in advance |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2016 06:21 AM |
| ####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2016 06:21 AM |
| ###################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
| |
|
|
| 01 Sep 2016 06:33 AM |
| ROBLOX safe chat isn't letting you see all of the script, but part2 is defined. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2016 07:01 AM |
'script.Parent.ClickDetector.MouseClick:conncect (OnClicked)' 'conncect' |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2016 07:18 AM |
| Thanks! I changed 'conncect' to 'connect', but it is still not doing anything. |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 01 Sep 2016 07:37 AM |
Try changing this, "if Wood == true then off() else on() end" To,
if Wood then off() else on() end
𝐉𝐮𝐬𝐭 𝐬𝐨𝐦𝐞 𝟏𝟒 𝐲𝐞𝐚𝐫 𝐨𝐥𝐝 |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2016 07:44 AM |
| Thanks for the response! I know it seems like I'm being really obstinate, but that didn't change anything either. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2016 10:39 AM |
| I have no idea what to do. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2016 10:46 AM |
___FIXED___
After 'function on()', I used 'Wood = false' by accident. It should have been 'Wood = true'.
Thanks for your help guys. |
|
|
| Report Abuse |
|
|