KuchiBoy
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 5374 |
|
|
| 07 Jul 2011 01:22 PM |
--------------------------------------------------BEGIN CODE tool = script.Parent function click(mouse) t = mouse.Target if t~=nil and t.Parent ~= game.Workspace and t.Locked == true then script.Parent.Parent.Parent:SaveInstance("ConstructModel1", t.Parent) print("successfully saved"..t.Parent.Name) end
end
function selected(mouse) mouse.Icon = "" mouse.Button1Down:connect(function () click(mouse) end) end
tool.Selected:connect(selected)
---------------------------------------------------------END CODE
It isn't giving any errors, and it isn't printing. What's wrong? |
|
|
| Report Abuse |
|
|
KuchiBoy
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 5374 |
|
|
| 07 Jul 2011 01:22 PM |
EDIT: I also have a load tool:
------------------------------BEGIN tool = script.Parent function click(mouse) script.Parent.Parent.Parent:WaitForDataReady() local part = script.Parent.Parent.Parent:LoadInstance("ConstructModel1") part.Parent = Workspace print("successfully loaded"..part.Name) end
function selected(mouse) mouse.Icon = "" mouse.Button1Down:connect(function () click(mouse) end) end
tool.Selected:connect(selected) --------------------------------END |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 01:34 PM |
| I may be wrong, but when tools are equipped, aren't they located in the character, not the player? |
|
|
| Report Abuse |
|
|
KuchiBoy
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 5374 |
|
|
| 07 Jul 2011 01:36 PM |
| This tool is a hopperbin. Should have mentioned that. |
|
|
| Report Abuse |
|
|
KuchiBoy
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 5374 |
|
| |
|
lucas668
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 6183 |
|
|
| 07 Jul 2011 01:54 PM |
| Hopperbins run scripts locally. Local scripts cannot access data saving/loading, so you have to use something else. A tool might work. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2011 01:54 PM |
| I know really nothing about DP, but if I am correct I think you need to wait for the data to be ready (this happens in an online server only, therefore you can't test it in roblox studio) and only then you can save or load data. |
|
|
| Report Abuse |
|
|
KuchiBoy
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 5374 |
|
|
| 07 Jul 2011 01:58 PM |
@blox I know this. It's only needed while loading. |
|
|
| Report Abuse |
|
|
KuchiBoy
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 5374 |
|
|
| 07 Jul 2011 02:01 PM |
| Found the problem, I think. It's because it only saved models if it was locked. Foolish mistake. I'm also making a tool. |
|
|
| Report Abuse |
|
|