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: I am failing at finding the player. Horribly

Previous Thread :: Next Thread 
LifeIsUnfairReturns is not online. LifeIsUnfairReturns
Joined: 10 Mar 2012
Total Posts: 4612
27 Jun 2013 12:24 PM
So what happens here is

you touch a brick

this is a touched function

when you touch the brick

I am going to anchor the torso

unfortunately

I have never learned how to find the player

It's probably about time I did it now

Here is my poor attempt


local TouchedIt = false

function Teleportation()
if TouchedIt == false then
Plyr = game.Players:findFirstChild(player)
Plyr.Torso.Anchored = true
TouchedIt = true

--some other crap is here but i removed it because I know it works


script.Parent.Touched:connect(Teleportation)
Report Abuse
BlueMond is not online. BlueMond
Joined: 26 Dec 2007
Total Posts: 47
27 Jun 2013 12:26 PM
function Teleportation(whatevertouchedthebrick)
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
27 Jun 2013 12:26 PM

function Hit(part)
if part.Parent:findFirstChild("Torso") ~= nil then
part.Parent.Torso.Anchored = true
end
end

script.Parent.Touched:connect(Hit)
Report Abuse
BlueMond is not online. BlueMond
Joined: 26 Dec 2007
Total Posts: 47
27 Jun 2013 12:29 PM
yeah he did a better job of describing it but in short you forgot to pass the parameter for the part that touched the thing that is being touched.
Report Abuse
LifeIsUnfairReturns is not online. LifeIsUnfairReturns
Joined: 10 Mar 2012
Total Posts: 4612
27 Jun 2013 12:31 PM
I realize that now


now I understand why output was saying it was missing an argument or whatever


let me try your code - I'll tell you the results
Report Abuse
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
27 Jun 2013 12:37 PM
This will contain errors, so u r gonna have to Open View>Output and read it.

local TouchedIt = false

function Teleportation(part) -- what 'part' hit this brick
if TouchedIt == false then -- r we not busy?
Touchedit = true -- close the gate so we r left alone.

local hum = part.Parent::findFirstChild(Humanoid) -- is there a Humanoid Object in the Parent of this part?

if hum then -- if so....
Plyr = part.Parent -- save a reference to that Parent
Plry.Torso.Anchored = true -- Anchor the Torso in the Parent of this part..
end -- humanoid?
.
.
TouchedIt = false -- Open gate

end -- busy, already?

end -- function



script.Parent.Touched:connect(Teleportation)

This may work, but more than likely no. U don't pay enough 4 me to test it. That's your job.

GL,
Bri

Report Abuse
BlueMond is not online. BlueMond
Joined: 26 Dec 2007
Total Posts: 47
27 Jun 2013 12:39 PM
That contains debounce, you should learn about that too so the script doesn't run like 50 times when the player steps on it.
Report Abuse
LifeIsUnfairReturns is not online. LifeIsUnfairReturns
Joined: 10 Mar 2012
Total Posts: 4612
27 Jun 2013 12:42 PM
I put debounce in the original

that was the touchedit value


anyway the script works fine - except when I anchor the torso you can still move in glitches

so I will set the walkspeed to 0 also

thanks everyone for the help
Report Abuse
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
27 Jun 2013 12:44 PM
I realize that now


now I understand why output was saying it was missing an argument or whatever


aLLWAYS POST AN ERROR MESSAGE IF U HAVE ONE With the original, otherwise people assume u don't have Output open, and will ususaly not help u, 'cause there is no point.
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