I’m attempting to script something where the tools that are within the ServerStorage end up cloning and transferring into my backpack upon joining the game.
The following tools that I’m trying to have cloned from ServerStorage is “KickBaton” & “BanBaton” and I then want them to be put into my inventory.
I’m not quite sure what I’m doing wrong here. I’ve tried correcting the errors that are appearing within the error console, that doesn’t appear to be working.
I would love some advice and help with this, that would be much appreciated!
local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
local MyUserId = 000000 -- Enter your UserId here
if Player.UserId == MyUserId then
local Backpack = Player.Backpack
local BanBaton = ServerStorage.BanBaton:Clone()
local KickBaton = ServerStorage.KickBaton:Clone()
BanBaton.Parent = Backpack
KickBaton.Parent = Backpack
else
print("Player does not match the 'MyUserId'")
end
end)
I don’t really want to touch a block or anything as such to receive the tools. I’m just wanting the tools to appear within my inventory upon joining. I’ve spend about an hour trying to figure out the issue prior to creating a post. Not sure what the underlying cause is.
The script I have provided above should work perfectly.
That must be another script interfering with this one since it says Touched is not a valid member of Backpack but I did not use any Touched events in the script I have provided sorry.
If you need help finding the script causing the error, it is located in the BanBaton and the script is called ‘Giver Script’ from the error message sent in your previous reply.
Upon further review, I’m no longer getting any error messages which are good. Although the script isn’t executing I believe as the tools aren’t appearing within my inventory upon joining.
The script is in the ServerScriptService which it’s suppose to be, and I don’t think that there’s another script interfering with this process.
I’m not quite sure what the underlying cause could possibly be. I’m just overall confused on what to do next as I’ve never had anything like this happen to me before within my 4 years on scripting.