Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I make players access their data on ServerStorage?

Asked by 7 years ago

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

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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)
0
Thank you very much sir! TheBinaryC0D3R 9 — 7y
0
Do I have to name them manually? or its automatic? TheBinaryC0D3R 9 — 7y
0
In the second script, line 7 is setting the `Name` Property. Goulstem 8144 — 7y
Ad

Answer this question