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

Why are tools disappearing when the round starts??

OK so MY game works pretty well, keep in mind im new to scripting. theres multiple maps and every map is chosen randomly. then when players are tped onto the map a random tool aka weapon gets chosen and puts it in the players backpack. now the sword and meelee items work great, like the energy sword, but a few of the guns like the laser gun and tommy gun and the knife have issues. basically when the weapon is chosen it equips it on the player immediatly and it shows that you dont have that weapon in your hands or physically. then if u click it disapears. now I did try to reequip the tool and the item did work then its something about when it starts like idk. ALSO keep in mind these gears are imported directly from the roblox avatar shop/catalog. so these are roblox's models or tools. this is really weird can someone help? I would appreciate it.

this is the local script in the laser gun and only a part of it that I think it may have something to do.

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	if not CheckIfAlive() then
		return
	end
	PlayerMouse = Player:GetMouse()
	Mouse.Button1Down:connect(function()
		InvokeServer("MouseClick", {Down = true})
	end)
	Mouse.Button1Up:connect(function()
		InvokeServer("MouseClick", {Down = false})
	end)
	Mouse.KeyDown:connect(function(Key)
		InvokeServer("KeyPress", {Key = Key, Down = true})
	end)
	Mouse.KeyUp:connect(function(Key)
		InvokeServer("KeyPress", {Key = Key, Down = false})
	end)
end

function Unequipped()
	for i, v in pairs(Animations) do
		if v and v.AnimationTrack then
			v.AnimationTrack:Stop()
		end
	end
	Animations = {}
end

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)

3 comments

0

Let us see the script...

0

i think this is this script

0

it might fall throughbt he void before being in the backpack

1 answer

My Best Guess Is To First Add A Folder in Replicated Storage Named "Items" And Put The Items In The Folder Then Add A Script In ServerScriptService Named "BackpackSave" --Do not add the "" :D

And The Script Should be like this

local dataStorageService = game:GetService("DataStorageService") local datastore = dataStorageService:GetDataStore("BackpackSave")

game.Players.PlayerAdded:connect(function(player) -- <---- Waits till The Player Has Fully Loaded :) pcal(function() local tool = datastore:GetAsync("User"..player.UserId) if tool then for i,v in pairs(tool) do local toolFound = game.ReplicatedStorage.Items:FindFirstChild("v") if toolFound then toolFound:Clone.Parent = player.Backpack toolFound:Clone.Parent = player.StarterGear end end end) end) game.Players.PlayerRemoving:connect(function(player) pcall(function() local toolSave = { } for i, tool in pairs(player.Backpack:GetChildren()) do if tool then table.insert(toolSave,tool.Name) end end datastore:GetAsync("User"..Player.UserId,toolSave) end) end)

--My Best Guess Idk try it .-. It Even Keeps Your things If you leave but idk how to do it for not leaving to save items :D

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