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 need someone to fix this...

Previous Thread :: Next Thread 
UT04master is not online. UT04master
Joined: 15 Aug 2009
Total Posts: 211
26 Nov 2011 10:31 AM
function onTouched(hit)
local function onKeyDown( key )
key: lower ()
if key == “f” then
if hit.Parent.Humanoid~= nil then
cash = game.Players:findFirstChild(hit.Parent.Name).leaderstats.Cash -- This finds who touched it and finds his money amount
if cash.Value >= 1250 then -- Checks if player has enough cash
cash.Value = cash.Value- 1250 -- Takes away that cash
script.Parent.Parent:remove() -- Removes door if you have cash
else
end
end
end
mouse.KeyDown:connect(onKeyDown)
script.Parent.Touched:connect(onTouched)
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
26 Nov 2011 10:43 AM
...


Don't try to use a Key event within a Touched event.
Report Abuse
UT04master is not online. UT04master
Joined: 15 Aug 2009
Total Posts: 211
26 Nov 2011 10:55 AM
I can only fix this one way but idk how; how do you script for distance (like if i wanted you to only be able to open it if you were within 9 studs distance)?
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
26 Nov 2011 11:12 AM
magnitude.

if (part.CFrame.p-torso.CFrame.p).magnitude <= 10 then
~st00f~
end
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
26 Nov 2011 11:13 AM
wow ok 9 not 10.
Report Abuse
UT04master is not online. UT04master
Joined: 15 Aug 2009
Total Posts: 211
26 Nov 2011 11:28 AM
Is this correct?




local function onKeyDown( key )
key: lower ()
if key == “f” then
if (part.CFrame.p-torso.CFrame.p).magnitude <= 9 then
if hit.Parent.Humanoid~= nil then
cash = game.Players:findFirstChild(hit.Parent.Name).leaderstats.Cash -- This finds who touched it and finds his money amount
if cash.Value >= 1250 then -- Checks if player has enough cash
cash.Value = cash.Value- 1250 -- Takes away that cash
script.Parent.Parent:remove() -- Removes door if you have cash
else
end
end
end
mouse.KeyDown:connect(onKeyDown)

Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
26 Nov 2011 11:33 AM
You didn't make this script, did you?
Report Abuse
UT04master is not online. UT04master
Joined: 15 Aug 2009
Total Posts: 211
26 Nov 2011 11:34 AM
Auctually I did... is it right?
Report Abuse
UT04master is not online. UT04master
Joined: 15 Aug 2009
Total Posts: 211
26 Nov 2011 11:39 AM
Why do you think I didn't make it?
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
26 Nov 2011 11:40 AM
part isnt defined in that script, or atleast the part you gave.
Report Abuse
UT04master is not online. UT04master
Joined: 15 Aug 2009
Total Posts: 211
26 Nov 2011 11:42 AM
Is this correct?




local function onKeyDown( key )
key: lower ()
if key == “f” then
if (game.Workspace.Doors.part.CFrame.p-torso.CFrame.p).magnitude <= 9 then
if hit.Parent.Humanoid~= nil then
cash = game.Players:findFirstChild(hit.Parent.Name).leaderstats.Cash -- This finds who touched it and finds his money amount
if cash.Value >= 1250 then -- Checks if player has enough cash
cash.Value = cash.Value- 1250 -- Takes away that cash
script.Parent.Parent:remove() -- Removes door if you have cash
else
end
end
end
mouse.KeyDown:connect(onKeyDown)
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
26 Nov 2011 11:50 AM
I thought you didn't make it because you didn't change 'torso' the the Torso! Any basic scripter would know to do that!
Report Abuse
UT04master is not online. UT04master
Joined: 15 Aug 2009
Total Posts: 211
26 Nov 2011 11:54 AM
Where is that?... actually some of it was copied from my brother's script. Does it work? what needs to be changed?
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
26 Nov 2011 11:55 AM
The part that I gave you about magnitude. I put in 'part' and 'torso' so you would know where to put the real ones in.
Report Abuse
UT04master is not online. UT04master
Joined: 15 Aug 2009
Total Posts: 211
26 Nov 2011 12:07 PM
So waht do i change it to so it will find all players' torso?
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
26 Nov 2011 12:09 PM
If you can't do that, I don't see how you made this.
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