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 » Scripting Helpers
Home Search
 

Re: Assignable hot keys save?

Previous Thread :: Next Thread 
Kasumo is not online. 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
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
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 is not online. 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
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
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 is not online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
09 Jun 2013 05:07 PM
Where in the script would I put that?
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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