|
| 10 Jan 2017 08:45 PM |
Script:
local re = Instance.new("RemoteEvent",workspace) local re2 = Instance.new("RemoteEvent",workspace) re.Name = "Open" re2.Name = "Close" re.OnServerEvent:connect(function() for i = 1,8 do wait(.5) workspace.Gate:TranslateBy(Vector3.new(0,1,0)) end end) re2.OnServerEvent:connect(function() for i = 1,8 do wait(.5) workspace.Gate:TranslateBy(Vector3.new(0,-1,0)) end end)
Local script: local player = game.Players.LocalPlayer local mouse = player:GetMouse()
repeat wait() until mouse.Target == workspace.ButtonUp if mouse.Target == workspace.ButtonUp then local debounce = false mouse.Button1Down:connect(function() if debounce == false then debounce = true workspace.Open:FireServer() end end) debounce = false end repeat wait() until mouse.Target == workspace.ButtonDown if mouse.Target == workspace.ButtonDown then local debounce = false mouse.Button1Down:connect(function() if debounce == false then debounce = true workspace.Close:FireServer() end end) end end end) end
Pictures: Log of the console: https://twitter.com/MyActiveAlts/status/819011110376308738 Heirarchy proof of existance: https://twitter.com/MyActiveAlts/status/819012066501500928
Why
|
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 08:51 PM |
I recommend putting RemoteEvent's in replicatedstorage:
local replicatedstorage = game:GetService('ReplicatedStorage') local event = replicatedstorage:WaitForChild('RemoteEvent') |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 08:56 PM |
| I even tried opening a new place and trying it there. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 09:00 PM |
| workspace:WaitForChild("ButtonUp") |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 09:01 PM |
| It wouldnt work at all if I did that because I tried |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 09:06 PM |
if you get the possible infinite yield error, then maybe the part does not exist for whatever reason
if you don't, then your script should work if you add the waitforchild at the beginning of the script |
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 10 Jan 2017 09:07 PM |
You sure? Try storing ButtonUp and ButtonDown as variables at the top of your script.
local ButtonUp = workspace:WaitForChild("ButtonUp") local ButtonDown = workspace:WaitForChild("ButtonDown")
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
| |
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 10 Jan 2017 09:30 PM |
Did you get the possible infinite yield warning or what?
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 09:32 PM |
| No the only warning I got is in the console picture saying it doesnt exist. That was in game |
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 10 Jan 2017 09:36 PM |
If you have a waitforchild then it shouldn't say it doesn't exist .-.
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 09:41 PM |
New script
https://twitter.com/MyActiveAlts/status/819026168682713088 |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 09:45 PM |
| the only thing that creates an infinite yeild is WaitForChild() |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 09:50 PM |
| Im sure this isnt it but maybe because im not using a click detector with a remote event? |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2017 10:10 PM |
| Wrath Can I give you the place and you see if it works for you? |
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 10 Jan 2017 10:19 PM |
Sure, just add me to team create and I'll see what I can do
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 11 Jan 2017 02:21 PM |
Okay, looking at this in an editor it's clearer why this might not work. A lot of the code here was simply unnecessary, I'm going to edit the code and paste bin it back to you.
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
| |
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 11 Jan 2017 02:28 PM |
pmed
Ever wanted to learn how to script? Check out my YouTube channel: youtube.com/austintheslayer Want to see me code in action? Follow my twitch: twitch.tv/austinrblx |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 11 Jan 2017 02:29 PM |
store remote events in replicated storage, not workspace
|
|
|
| Report Abuse |
|
|
|
| 11 Jan 2017 03:27 PM |
| ^ That's what I exactly said. |
|
|
| Report Abuse |
|
|
|
| 11 Jan 2017 03:28 PM |
| YA THATS WHAT HE EXACTLY SAID STOP STEALING HIS IMPUT OK? x |
|
|
| Report Abuse |
|
|
|
| 11 Jan 2017 03:30 PM |
"store remote events in replicated storage, not workspace"
has nothing to do with his problem and doesn't matter anyway |
|
|
| Report Abuse |
|
|
|
| 11 Jan 2017 04:26 PM |
| ###### We only said it's recommended to store remoteEvents in replicatedstorage. We didn't say it was the problem.. |
|
|
| Report Abuse |
|
|
| |
|