TOOL SPAWNER SCRIPT =
wait(5) -- Put the following code in your script at the point where you want players to get their tool.
for i, v in pairs(game.Players:GetPlayers()) do if v.EquippedTool.Value == "" then
-- Give them a basic tool else local tool = game.ServerStorage[v.EquippedTool.Value]:Clone() tool.Parent = v.Backpack end end
HERE IS THE DATA SCRIPT =
local DSService = game:GetService('DataStoreService'):GetDataStore('Videoscript32') game.Players.PlayerAdded:connect(function(plr)
-- Define variables local uniquekey = 'id-'..plr.userId local leaderstats = Instance.new('IntValue', plr) local savevalue = Instance.new('StringValue') leaderstats.Name = 'leaderstats' savevalue.Parent = plr savevalue.Name = 'EquippedTool'
-- GetAsync local GetSaved = DSService:GetAsync(uniquekey) if GetSaved then savevalue.Value = GetSaved[1] else local NumbersForSaving = {savevalue.Value} DSService:SetAsync(uniquekey, NumbersForSaving) end end) game.Players.PlayerRemoving:connect(function(plr) local uniquekey = 'id-'..plr.userId local Savetable = {plr.EquippedTool.Value} DSService:SetAsync(uniquekey, Savetable)
end)
HERE IS THE SCRIPT FOR MOUSE CLICKING THE GUI =
script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.EquippedTool.Value = tostring(script.Parent.Name) end)