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

Tool when cloned for replicatedstorage, script do not working how to fix?

How to fix the item when cloned the script inside it does not work Here is my code

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
	local p = game.Players:GetPlayerFromCharacter(char)
	game.ReplicatedStorage.Medkit:Clone().Parent = p.Backpack		
	end)
end)

Thank you

1 comment

0

Make sure "Medkit" is a tool and you have player object at the first place(in PlayerAdded event), you don't need to get the Player again from the Character.

2 answers

✓ Accepted answer

Try doing this instead.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
    local p = game.Players:GetPlayerFromCharacter(char)
    local Medkit = game.ReplicatedStorage.Medkit:Clone()
	     Medkit.Parent = p.Backpack
    end)
end)

2 comments

0

Thank for answer! I'm testing please wait

0

Question solved, thank for answer!

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