✓ Accepted answer
Well first thing, I see you're using LocalPlayer, there is 2 problems with this:
- If you give the tool using a
LocalScript, it will not be replicated in the server
- You're using
ServerStorage, LocalScripts cannot access ServerStorage
Plus, it isn't necessary, as we already have the player variable
So instead, put your code in a normal script, here's a version that should work:
local CallMsg = "sword"
local item = game.ServerStorage.R6Sword
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == CallMsg then
local original = item
local copy = original:Clone()
copy.Parent = player.Backpack
end
end)
end)
You can place this script in ServerScriptService if you'd like
Oh and btw, I recommend using ReplicatedStorage to store tools.
1 comment
Thanks a lot!