Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 09 Jun 2013 04:56 PM |
| I have a Gui where a player can assign a skill to a hotkey, but whenever the player dies/leaves the game, they dissappear! Help? |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 04:57 PM |
Is the hotkey data kept in a script or in a model? If it's kept in a script, how are you keeping it in the script?
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 09 Jun 2013 05:00 PM |
It is kept in a script. Here is the hotkey script:
hotkey1 = script.Parent.Reset_Label.HotKey keys = { key1 = "", key2 = "" }
-- findObj = function(ins) for i, v in pairs(keys) do if string.lower(v) == ins then return true, string.lower(v) end end end -- mouse = game.Players.LocalPlayer:GetMouse() -- mouse.KeyDown:connect(function(ke) if string.lower(ke) == string.lower(keys.key1) then --[Function here]-- elseif string.lower(ke) == string.lower(keys.key2) then print("Hi") end end) -- hotkey1.Changed:connect(function(prop) if prop == "text" or prop == "Text" and #hotkey1.Text == 1 then keys.key1 = hotkey1.Text end end)
|
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 05:05 PM |
Try using Data Persistence, and the RbxUtility library like so:
player:SaveString("hotkeys", LoadLibrary("RbxUtility").EncodeJSON(hotkey1)) hotkey1 = LoadLibrary("RbxUtility").DecodeJSON(player:LoadString("hotkeys"))
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 09 Jun 2013 05:07 PM |
| Where in the script would I put that? |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2013 05:12 PM |
I just remembered... it needs to be a normal script for it to work. And in your changed function. Also add a thing at the beginning that uses the load method to get the old table.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
|
| Report Abuse |
|
|