|
| 17 Jul 2016 07:45 AM |
| Ok, so say I have a money column on my leaderboard. What I need in my game is a door that opens upon touching it, but only if you have enough money. On top of that, It should not take away your money. If I have my cash column and door set up (door has no scripts) What kind of stuff should I add to make this possible? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 17 Jul 2016 07:56 AM |
local debounce = false
door.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then local stats = player:WaitForChild('leaderstats') local money = stats.Money if money.Value >= 250 and not debounce then debounce = true door.Transparency = 0.5 door.CanCollide = false money.Value = money.Value - 250 wait(1) debounce = false end end end)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Jul 2016 04:13 AM |
| Actually I did just remember something. What is the lind pf code that searches for the correct money amount? |
|
|
| Report Abuse |
|
|
sentry3
|
  |
| Joined: 01 May 2010 |
| Total Posts: 538 |
|
|
| 19 Jul 2016 09:16 AM |
| 'if money.Value >= 250' the number is the moneyamount |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Jul 2016 05:34 AM |
| The script timeticks gave me, does it deduct the smount of money after unlocking he door? I believe it does, but Id just like clzrification |
|
|
| Report Abuse |
|
|
yankana
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 431 |
|
|
| 20 Jul 2016 05:37 AM |
Yes it does,
"money.Value = money.Value - 250"
Remove that line if you don't want it to remove your money. |
|
|
| Report Abuse |
|
|
yankana
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 431 |
|
| |
|
|
| 20 Jul 2016 07:41 AM |
| Ok yes. That was what I thought. Knowing code, I didn't quite know if that was it or not. |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2016 07:41 AM |
| Also, sorry to double post, but how would one edit the script to make a brick dissapear upon touch if you had enough money? |
|
|
| Report Abuse |
|
|
|
| 21 Jul 2016 06:42 AM |
| Ok sorry! But dies this script a one payment, never pay to unlock again? |
|
|
| Report Abuse |
|
|