|
| 21 Jun 2014 02:02 AM |
| Is it possible to DataStore StringVales? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 21 Jun 2014 02:42 AM |
Strings yes StringValues no |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 03:20 AM |
Well, I changed it to an "IntValue".
So what's wrong with this, after it minuses by two seconds the value changes right to 0: local Player = Game.Players.LocalPlayer local CashPLAYER = Player:WaitForChild("CashPLAYER"); local LevelPLAYER = Player:WaitForChild("LevelPLAYER"); local Timer = Player:WaitForChild("Timer"); local PlayerGui = Player:WaitForChild("PlayerGui"):WaitForChild("Menu"); local Notification = PlayerGui.TextLabel5
Timer.Value = 15
while Timer.Value > 0 do Timer.Value = Timer.Value - 1 if Timer.Value == 0 and Player ~= nil then Timer.Value = 15 CashPLAYER.Value = CashPLAYER.Value + 75 Notification.Visible = true wait(3) Notification.Visible = false end wait(1) end |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 21 Jun 2014 03:23 AM |
Try this instead of the while loop:
while true do repeat Timer.Value = Timer.Value - 1 CashPLAYER.Value = CashPLAYER.Value + 75 Notification.Visible = true wait(3) Notification.Visible = false wait(1) until Timer.Value == 0 if Timer.Value == 0 and Player ~= nil then Timer.Value = 15 end end
Idk |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 03:27 AM |
That made the player cash increase every second. And then made the seconds minus by negatives...
Can anyone fix this? |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 21 Jun 2014 03:29 AM |
| What, did it start at 15 seconds then go negative? |
|
|
| Report Abuse |
|
|
| |
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 21 Jun 2014 03:35 AM |
| I dont see anything wrong with the script... are you sure you dont have a different script affecting Timer? |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 03:37 AM |
Is something that could be doing that:
local Player = script.Parent.Parent.Parent.Parent.Parent local Timer = Player:WaitForChild("Timer");
while true do script.Parent.Text = Timer.Value wait() end |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
| |
|
|
| 21 Jun 2014 03:43 AM |
| The timer is an "IntValue". Witch is DataStored. I figured all the other DataStoring cash and level works so this should? Could it because it's and IntValue or DataStored? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 21 Jun 2014 03:44 AM |
| Unless you're updating the timer by using :GetAsync every time you save,no.. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 03:46 AM |
| That's probably why. What shall I use? By the way, thanks for helping! |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
| |
|
|
| 21 Jun 2014 03:53 AM |
Timer.Value = Data28:UpdateAsync("UserTimer_"..Player.userId) or 15
It goes nil... Am I doing something wrong? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 21 Jun 2014 03:56 AM |
| Actually dont bother getting the Timer.Value from datastore. delete that line altogether |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 03:57 AM |
What do you mean? Just remove Timer.Value?
Data28:UpdateAsync("UserTimer_"..Player.userId) or 15 |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 21 Jun 2014 03:59 AM |
This entire line
"Timer.Value = Data28:UpdateAsync("UserTimer_"..Player.userId) or 15"
its unneeded |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 04:01 AM |
| Well then how could It be saved? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 21 Jun 2014 04:02 AM |
| why exactly do you need to save the timer? |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 04:04 AM |
| Once the player dies, the timer resets. Or if I want to change the time to like 3 hours then it wont save. 15 seconds its just for testing. |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 21 Jun 2014 04:09 AM |
| just change Timer.Value then |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 04:10 AM |
| You told me to remove that... |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 21 Jun 2014 04:14 AM |
I mean set it directly Timer.Value = 15 No need to use complicated things like DataStore for it Also in this case if you want to save
D28:SetAsync("Timer", Timer.Value) |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 04:19 AM |
| This is not working...I do everything you say! |
|
|
| Report Abuse |
|
|