spinywind
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 3580 |
|
|
| 13 Dec 2015 11:35 PM |
Iv been struggling on this code for a while now. I can only seem to get the point rewarder and text changer done. I really need help on this one.
What needs to be fixed: - I basically want it so that when you redeem a correct code, the amount of points you get from the code from a value, you will get every game when you join a new server
What needs to be done: - Making it so a player can only put a code in once no matter what server there in or if they reset or just in general. Just so the code can only be used once for ever
If anyone can manage to do this id appreciate it a lot and put you as an admin to all my games.
Now this code is in a server script.
Code:
function A() game.Players.PlayerRemoving:connect(function(p) if p:findFirstChild("leaderstats") then p:SaveInstance("SavedStatPNum"..tostring(game.PlaceId),p.leaderstats) end end) game.Players.PlayerAdded:connect(function(p) for k = 1, 60, 0.03 do wait() if p:findFirstChild("leaderstats") and p.DataReady then break end end local Loaded = nil if p:findFirstChild("leaderstats") and pcall(function() Loaded = p:LoadInstance("SavedStatPNum"..tostring(game.PlaceId)) end) then for j, v in pairs(Loaded:GetChildren()) do pcall(function() p.leaderstats.Points = p.leaderstats.Points + 1500 end) end end end) local Points = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Points if script.Parent.Parent.Code.Text == script.Parent.Parent.Code.Code.Value then script.Parent.Sound:Play() Points.Value = Points.Value + 1500 wait(1) script.Parent.Parent.Code.Text = "Click to enter your code" elseif script.Parent.Parent.Code.Text == "Santa" or "SANTA" or "sANTA" or "santA" then script.Parent.Parent.Code.Text = "Invalid Code" wait(4) script.Parent.Parent.Code.Text = "Click to enter your code" end end
script.Parent.MouseButton1Down:connect(A) |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2015 11:39 PM |
| Your wasting your time learning data persistence; use datastores, their much more efficient and secure. |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2015 11:50 PM |
| Data persistence is outdated, use datastore. It has far better capabilities and is much more reliable. |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2015 12:04 AM |
http://wiki.roblox.com/index.php?title=Saving_Player_Data That page will show you how to save player data efficiently with datastores.
If money grew on trees... It would be as valuable as leaves. | Twitter: @TwisterRBLX |
|
|
| Report Abuse |
|
|