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

How do i make my map reset script reset my map?

Asked by 4 years ago

how do i make a script where when i execute it it will clone all of the workspace into replicated storage, delete the stuff in the original, and then take the clone back, ive tried doing it ill show what i tried.

function onChatted(msg, recipient, speaker) 

local source = string.lower(speaker.Name) -- Converts name of speaker to lowercase
msg = string.lower(msg)

    if (msg == "/map") then --Chat Command
        wait(1) 
        game.Workspace:ClearAllChildren()
        wait(0.2)
        wait(1)
    --Action here.
    end 

end 


-- Do not edit without experience.
function onPlayerEntered(newPlayer) 
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered)

then the 2nd script which executed after

function onChatted(msg, recipient, speaker) 

local source = string.lower(speaker.Name) -- Converts name of speaker to lowercase
msg = string.lower(msg)

    if (msg == "/map") then --Chat Command
        wait(1)
        local original = game.Workspace
        local copy = game.ReplicatedStorage.Map:Clone()

        wait(0.2)
        copy.Parent = game.Workspace
        wait(1)
    --Action here.
    end 

end 


-- Do not edit without experience.
function onPlayerEntered(newPlayer) 
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered)
0
copy everything in workspace and group it, name it Map duplicate it so there is 2 and put one in ReplicatedStorage, did u do that? CosmicIsGod 139 — 4y
0
yes pokemon9master29 6 — 4y

Answer this question