generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Is There A Way

Previous Thread :: Next Thread 
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
29 Nov 2012 10:10 PM
To insert a value into a player when they touch something, And then remove it when they untouch it?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Nov 2012 10:14 PM
    Touched event
      Instance value
    end(s)

    TouchEnded event
      Remove value
    end(s)

¤¤ †KMXD† ¤¤
Report Abuse
defectiveman is not online. defectiveman
Joined: 09 May 2010
Total Posts: 30
29 Nov 2012 10:16 PM
Lol Thanks
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
29 Nov 2012 10:20 PM
I dont know how to use touch ended -.-
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
29 Nov 2012 10:21 PM
part.TouchEnded:connect(function()
--code
end)

~ Moo logic = logical logic ~
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
29 Nov 2012 10:27 PM
Like this?

function onTouch(part)
--Code
end
part.TouchEnded:connect(function()
--code
end)
script.Parent.Touched:connect(onTouch)
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
29 Nov 2012 10:28 PM
or if you rather

function onTouchEnded(part) -- not sure if part is even an actual thing, but I would assume its the thing that left the part.
--code
end
script.Parent.TouchEnded:connect(onTouchEnded) --I dont like theese connection lines.

~ Moo logic = logical logic ~
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
29 Nov 2012 10:29 PM
function onTouch(hit)
print("Touch")
end
hit.TouchEnded:connect(function()
print("Untouch")
end)
script.Parent.Touched:connect(onTouch)



22:28:43 - Workspace.Part.Script:4: attempt to index global 'hit' (a nil value)
22:28:43 - Script "Workspace.Part.Script", Line 4
22:28:43 - stack end
Report Abuse
Isaiahmk989 is not online. Isaiahmk989
Joined: 16 Jul 2008
Total Posts: 33
29 Nov 2012 10:38 PM
touching = false
script.Parent.Touched:connect(function()
touching = true
end)
script.Parent.TouchEnded:connect(function()
touching = false
end)
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
29 Nov 2012 10:39 PM
you ended your function too early
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image