|
| 16 Apr 2013 09:13 AM |
I am making a brick, that once stepped on removes a LinkedSword from the humanoid that touches it from the Humanoid's backpack.
This is how far I have been able to go with it:
function onTouch() local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then --if a humanoid exists <----- the actual removing part I believe goes here script.Parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 16 Apr 2013 09:18 AM |
Hi!
Just to be clear, this post isn't hostile... If it is, consider the whole world as hostile.
I suggest you take a few free models that do the same as what you want, learn how they work and try to edit some things. If your edited code works, try making it yourself. That is the easiest way to learn how to script.
Good luck! |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2013 09:23 AM |
"Humanoid's backpack"
>First off, the backpack is in the Player, not the Humanoid. Second, do what getkoed said, just learn off of free models by editing them and seeing if they contain stuff that you don't already know and such.
~If you're generous enough: http://www.roblox.com/--item?id=97553537~ |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2013 09:59 AM |
@getkoed2
There is nothing hostile about your post on this thread in particular, but that really doesn't help me. Just saying "learn to scipt" as a reply to a question on a forum called "Scripting Helpers" isn't all that useful. |
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 16 Apr 2013 10:52 AM |
Could you please state where I said 'learn to script'?
Thank you! |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 16 Apr 2013 03:22 PM |
I think you're overreacting. He's just saying the easiest way to learn to script, the way I did it. Here's the script:
function onTouch(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr ~= nil then repeat wait() until plr.Backpack.LinkedSword plr.Backpack.LinkedSword:Destroy() end end end
script.Parent.Touched:connect(onTouch)
If it errors, remove the third end. I'm not sure if repeat needs an end. |
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 16 Apr 2013 05:02 PM |
| No, it doesn't. Basically the line after until is the 'end' of repeat. |
|
|
| Report Abuse |
|
|
ForceSky
|
  |
| Joined: 30 Jul 2012 |
| Total Posts: 2379 |
|
|
| 16 Apr 2013 08:13 PM |
Ah, ok. The correct script:
function onTouch(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr ~= nil then repeat wait() until plr.Backpack.LinkedSword plr.Backpack.LinkedSword:Destroy() end end
script.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|