Hello, I’m trying to clone a tool into the player’s backpack if he is in the group.
Here is the code:
game.Players.PlayerAdded:Connect(function(plr)
if plr:IsInGroup(groupID) then
local tool = game.ReplicatedStorage.key:Clone()
tool.Parent = plr:WaitForChild("Backpack")
end
end)
(I have 2 scripts)
The error I am getting in another script: key is not a valid member of Backpack "Players.liamazu1000.Backpack"
Using this in a Script , as opposed to a LocalScript , will not get you the most up-to-date information. If a player leaves a group while they are in the game, IsInGroup will still think they’re in that group until they leave. However, this does not happen when used with a LocalScript.
It seems that sometimes it may work on the server, but other times it won’t. What I reckon you should do is send a remote event from the client and give the tool on the server. Moreover, it doesn’t really help when you say there’s an error in another script, but you don’t provide it. The error seems to be something got to do with checking ‘key’ in the player’s backpack, or something along the lines of that.
key is not a valid member of Backpack is saying that it cannot find a child of Players.liamazu1000.Backpack named “key” also can you show the error in the other script please as that is where the error is