carstormJoin Date: 2008-03-29 Post Count: 2266 |
What would create more lag to open a door: A click detector or a touched event? |
|
qrcristJoin Date: 2008-07-22 Post Count: 805 |
The lag would be created opening the door if any lag is created. |
|
|
Since the Touched event fires every time it's touched, and when you touch something, the Touched event will fire a bunch of times, I'd suggest the MouseClick event. Plus, ClickDetectors are cooler :3 |
|
carstormJoin Date: 2008-03-29 Post Count: 2266 |
Ya which one of would cause less lag. In other words which one do you recommend I use! |
|
CardCaddyJoin Date: 2010-01-02 Post Count: 1025 |
Neither, both are ugly events. |
|
|
@Card: Then what would you suggest? |
|
|
i suggest clicker, since it is cooler, and it only runs the function once per click. |
|
carstormJoin Date: 2008-03-29 Post Count: 2266 |
Ok thank you clicker to open door it is! |
|
carstormJoin Date: 2008-03-29 Post Count: 2266 |
I tried to make the script but it's not working and there is no output.
door = script.Parent.Parent
open = false
function onClick()
if not open then
door.Transparency = 1
door.CanCollide = false
wait(2.5) --automatically closes the door after 2.5 seconds
door.Transparency = .4
door.CanCollide = true
else
door.Transparency = .4
door.CanCollide = true
end
open = not open
end
script.Parent.MouseClick:connect(onClick)
|
|
|
.ClickDetector.MouseClick -- for your connection |
|
|
'open = not open' --don't understand this line?... |
|
|
correction:
-----------
door = script.Parent.Parent
local open = false
function onClick()
if not open == true then retun end --you forgot "== true" and script wont work if not false
door.Transparency = 1
door.CanCollide = false
print("door opened")
wait(2.5) --automatically closes the door after 2.5 seconds
door.Transparency = .4
door.CanCollide = true
print("door closed")
open = false
end
script.Parent.MouseClick.Clicked:connect(onClick) --you forgot ".Clicked"
|
|
carstormJoin Date: 2008-03-29 Post Count: 2266 |
@sarah
When I did that I get this error
Workspace.GasDoorRight.ClickDetector.openDoor:18: '=' expected near '..' |
|
|
*quick edit*
door = script.Parent.Parent
local open = false
function onClick()
if not open == true then retun end --you forgot "== true" and script wont work if not false
open = true --forgot to put this in
door.Transparency = 1
door.CanCollide = false
print("door opened")
wait(2.5) --automatically closes the door after 2.5 seconds
door.Transparency = .4
door.CanCollide = true
print("door closed")
open = false
end
script.Parent.MouseClick.Clicked:connect(onClick) --you forgot ".Clicked"
|
|
|
try:
.ClickDetector.MouseClicked |
|
|
the correct detector is '.Clicked'
so it would be 'ClickDetector.Clicked:connect(yadda yadda yadda)' |
|
carstormJoin Date: 2008-03-29 Post Count: 2266 |
@artoodetoo
This is the output
Workspace.GasDoorRight.ClickDetector.openDoor:5: '=' expected near 'end' |
|
|
did you use my quick edited one? |
|
carstormJoin Date: 2008-03-29 Post Count: 2266 |
ya |
|
|
try taking out 1 =, the reply result |
|
|
carstormJoin Date: 2008-03-29 Post Count: 2266 |
1 = which line is that on (I don't see it) |
|
|
door = script.Parent.Parent
local open = false
function onClick()
if open then return end--changed
open = true
door.Transparency = 1
door.CanCollide = false
print("door opened")
wait(2.5)
door.Transparency = .4
door.CanCollide = true
print("door closed")
open = false
end
end--forgot end, here
door.ClickDetector.MouseClick:connect(onClick)--you have ClickDetector in the door, right? |
|
|
remove one equal sign from 'if not open == true then return end' |
|
|
@Original Question;
As long as you know what you're doing and don't make your event functions overly complicated, it really won't matter. |
|