Roblox Lua 给 LocalPlayer 武器不起作用,

Roblox Lua Give LocalPlayer weapon doesn't work,

我的代码:https://justpaste.it/87evk

local original = game:GetService("ReplicatedStorage"):FindFirstChild("CloneSmoke")
 
local tool = script.Parent
local copy = original:Clone()
 
tool.Activated:Connect(function()
print("Running...")
local sound = script.Parent.Sound
 
copy.Parent = script.Parent.Handle
sound:Play()
wait(3)
tool:Destroy()
local plr = game.Players.LocalPlayer
local weapon = game.ReplicatedStorage.Jutsus.Momoshiki["Momoshikis Sword"]
local w2 = weapon:Clone()
w2.Parent = plr.Backpack
end)

不知道我必须在这里做什么才能得到玩家并给他一个 Weapon.I 尝试了很多但我没有得到正确的解决方案。
你帮我真是太好了

首先,确保这是在 LocalScript 中

同时将 local original = game:GetService("ReplicatedStorage"):FindFirstChild("CloneSmoke") 更改为 local original = game:GetService("ReplicatedStorage"):WaitForChild("CloneSmoke") 这是因为脚本加载速度比游戏中的物品快,所以很可能在脚本运行时剑尚未加载到游戏中;如果找不到您要引用的对象,脚本将无法运行。