just so you know i do have the tools in replicated storage and the script does give me the tool based on the value but only on studio (the new text editor is weird so i did not put any effort into fixing the messed up indenting) Edit: What an easy fix, the issue was that the tools weren't loading in time so i had to add "WaitForChild()" Edit2: That fix didn't actually work. Edit3: Replaced the respawn function with player.CharacterAdded
local replicatedStorage = game:GetService("ReplicatedStorage") game.Players.PlayerAdded:Connect(function(player) local class = Instance.new("StringValue",player) class.Name = "Class" class.Value = "Stick" if class.Value == "Stick" then wait(.1) local clone = replicatedStorage.Stick:Clone() clone.Parent = player.Backpack elseif class.Value == "Axe" then wait(.1) local clone = replicatedStorage.Axe:Clone() clone.Parent = player.Backpack end game.Workspace[player.Name].Humanoid.Died:Connect(function() wait(5) if class.Value == "Stick" then wait(.1) local clone = replicatedStorage.Stick:Clone() clone.Parent = player.Backpack elseif class.Value == "Axe" then local clone = replicatedStorage.Axe:Clone() clone.Parent = player.Backpack end end) end)
Hi. First of all, I hope you will succeed with your game. Now, to the errors you've made!
So you didn't actually make errors, only that the tools have no place to be stored in. What I usually do is add a folder into the player using Instance.new
And putting tools into it. You could find an example from one of my projects in the "Code" section of this article
This is how I set up my values:
local toolsFolder = Instance.new("Folder") toolsFolder.Parent = game.Players.Localplayer toolsFolder.Name = game.Players.Localplayer.Name local class = Instance.new("StringValue") class.Parent = toolsFolder class.Name = "Class" class.Value = "Stick"
The code matters because the game will sometimes get confused since the value is stored in all players. To prevent this, I named the folder whatever the player name is.
Hope this helps! Please marked question as answered from this answer if this was helpful! If it wasn't helpful, comment on this in the next 24 hours and I might come back to help! Hope your game gets successful!
The tools don't load in time when the script runs, to solve this add a "WaitForChild()" on the part where you are mentioning the tools Edit: use player.CharacterAdded instead of game.Workspace[player.Name]