Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make players access their data on ServerStorage?

After they save how can they access their own data without others interfering?

local Model = game.Workspace.Model

function save() Model:Clone().Parent = game.ServerStorage wait(2) Model:destroy() end

script.Parent.MouseButton1Down:connect(save)

function load() ModelCopy = game.ServerStorage.Model ModelCopy:Clone().Parent = game.Workspace end

script.Parent.MouseButton1Down:connect(load)

1 answer

✓ Accepted answer

I would name the copies of the model in a way that corresponds to the player..

like so:

local Player = game.Players.LocalPlayer

function save() 
	--reference from player's name
	local Model = workspace:FindFirstChild(Player.Name.."'s model")
	if Model then --check if it exists
		local c = Model:Clone()
		c.Parent = game.ServerStorage 
		wait(2) 
		Model:Destroy()
	end
end

script.Parent.MouseButton1Down:Connect(save)

local Player = game.Players.LocalPlayer
local Model = game.ServerStorage.Model

function _load() 
	local ModelCopy = Model:Clone()
	--name corresponding to player's name
	ModelCopy.Name = Player.Name.."'s model"
	ModelCopy.Parent = workspace 
end

script.Parent.MouseButton1Down:Connect(_load)

3 comments

0

Thank you very much sir!

0

Do I have to name them manually? or its automatic?

0

In the second script, line 7 is setting the Name Property.

This discussion is preserved as it was. New answers, comments, and votes are closed.