Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 03 Aug 2015 08:54 AM |
I just ran a 3 line script, for when you touch a brick it prints something. Nothing printed, but it did in studio.
Roblox broke it? same update as "function ot enabled"? |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 03 Aug 2015 08:55 AM |
| by studio i mean solo mode |
|
|
| Report Abuse |
|
|
WoolHat
|
  |
| Joined: 19 May 2013 |
| Total Posts: 1873 |
|
|
| 03 Aug 2015 09:01 AM |
| Function not enabled has been something run through outputs since about the release of Win10. It doesn't break any scripts (as far as I know), so just ignore it. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 03 Aug 2015 09:04 AM |
That isn't the problem.
Touched isn't working... |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 09:15 AM |
i found this works more cleaner for my scripting
script.Parent.Touched:connect(function()
end)
|
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 09:18 AM |
Works more Cleaner?... Ow. My head. Did you mean works better or more effective?
And I find doing that better as well. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 03 Aug 2015 09:20 AM |
| Well? Does touched work for anyone else in play mode |
|
|
| Report Abuse |
|
|
WoolHat
|
  |
| Joined: 19 May 2013 |
| Total Posts: 1873 |
|
|
| 03 Aug 2015 09:23 AM |
Oh my, sorry I skimmed D:
script.Parent.Touched:connect(function() --code here end)
function whateverfunction() --code here end
script.Parent.Touched:connect(whateverfunction)
If neither of those are working, post the code and we can probably figure it out. Again, sorry for that first response, lol. Early morning |
|
|
| Report Abuse |
|
|
WoolHat
|
  |
| Joined: 19 May 2013 |
| Total Posts: 1873 |
|
|
| 03 Aug 2015 09:23 AM |
| And yes, it has been working for me perfectly fine. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 09:24 AM |
| Yes works perfectly for me in play mode. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 03 Aug 2015 09:25 AM |
game.Workspace.WEST.Touched:connect(function(hit) print("NoPrinterino") end)
no printing in play mode
prints in test mode |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 03 Aug 2015 09:27 AM |
is game.Wokrpsace.WEST even being touched? does "WEST" exist or are there two wests? |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 09:29 AM |
Try this, just for sag:
workspace.WEST.Touched:connect(function(hit) print("NoPrinterino") end) |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 03 Aug 2015 09:35 AM |
print(workspace:FindFirstChild"WEST") does it exist? |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 09:58 AM |
It is important to realize what
function example()
end
whatever.Event:connect(example)
...and...
whatever.Event:connect(function()
end)
are capable of.
In the first one, a function is created, malleable, and can be used many time. Int he second example, a final static function is create, not malleable, therefore can only be used once in a certain way.
For extendability, it is good to know how to take control.
Let's take the Touched event for example. game.Workspace.Part.Touched
We have many parts that kill a player. It is easy just to...
script.Parent.Touched:connect(function(hit) if(hit.Parent)then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if(plr)then plr.Character.Humanoid:TakeDamage(plr.Character.Humanoid.MaxHealth) end end end)
Now instead of creating all of these scripts inside of all these parts... (Let's take the example of 100)
We can batch over all of these parts and apply a single function to them. (and not 100 functions (and not in 100 scripts))
local onTouch = function(hit) if(hit.Parent)then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if(plr)then plr.Character.Humanoid:TakeDamage(plr.Character.Humanoid.MaxHealth) end end end
local apply = function(event, funct) event:connect(funct) end
for i, v in pairs(script.Parent:GetChildren())do if(v:IsA("Part"))then --Note you CAN NOT make a RBXScriptSignal stay in a for loop. --It will simply just go away. So I had to make the apply function apply(v.Touched, onTouch) end end
|
|
|
| Report Abuse |
|
|