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 » Scripters
Home Search
 

[ Content Deleted ]

Previous Thread :: Next Thread 
jackrabbit898 is not online. jackrabbit898
Joined: 15 Aug 2014
Total Posts: 113
24 Dec 2014 03:27 PM
I need help making a script that goes in a giver that, when touched, it takes away 'Robux' (The name of the currency) from that player who steps/touches it.
I'm not a very good scripter.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
24 Dec 2014 03:29 PM
I'd suggest you go look at the Touched event and Getting a Player from a Character
Report Abuse
jackrabbit898 is not online. jackrabbit898
Joined: 15 Aug 2014
Total Posts: 113
24 Dec 2014 04:07 PM
I want it to take away 100 from the actual money and in leaderstats
Report Abuse
jackrabbit898 is not online. jackrabbit898
Joined: 15 Aug 2014
Total Posts: 113
24 Dec 2014 04:15 PM
I just don't understand it. Just please give me the script
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
24 Dec 2014 04:21 PM
[ Content Deleted ]
Report Abuse
jackrabbit898 is not online. jackrabbit898
Joined: 15 Aug 2014
Total Posts: 113
24 Dec 2014 04:28 PM
Me?
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
24 Dec 2014 04:47 PM
[ Content Deleted ]
Report Abuse
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
24 Dec 2014 04:51 PM
Maybe this will help, the script's parent must be the part
script.Parent.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
plr.leaderstats.(NameOfCurrencyHere).Value = plr.leaderstats.(NameOfCurrencyHere).Value - (how much you want to subtract)
end
end)
Report Abuse
jackrabbit898 is not online. jackrabbit898
Joined: 15 Aug 2014
Total Posts: 113
24 Dec 2014 05:20 PM
It all worked except the (how much you want to subtract) part, instead of subtracting that I have no idea what it did. Here's my script:

script.Parent.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
plr.leaderstats.Robux.Value = plr.leaderstats.Robux.Value - 100
end
end)

The starting value is 100. When I touched it it made the value -400
Report Abuse
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
24 Dec 2014 06:07 PM
It must be because mulitple parts touched it at once, I'll change the script a bit :

local cooldown = false

script.Parent.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum and cooldown == false then
cooldown = true
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
plr.leaderstats.Robux.Value = plr.leaderstats.Robux.Value - 100
wait(thewaitamount)
cooldown = false
end
end)
Report Abuse
jackrabbit898 is not online. jackrabbit898
Joined: 15 Aug 2014
Total Posts: 113
07 Feb 2015 03:47 PM
Thanks but could you possibly modify it so that if they don't have the amount of money that they need, it doesn't give it to them
(I haven't tested it but looking at the script I believe if they don't have 100, it'll just make their money value negative but still give them the hat)
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
07 Feb 2015 03:53 PM
Try this:

local Debounce = false

script.Parent.Touched:connect(function(hit)
if Debounce = false then
Debounce = true
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
local LeaderStats = Player:WaitForChild("leaderstats")
local ROBUX = LeaderStats:WaitForChild("Robux")
if ROBUX.Value >= 100 then
ROBUX.Value = ROBUX.Value - 100
--Give hat
wait(2)
Debounce = false
end
end
end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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