The problem is it keeps telling me the parent is locked. Please notie the coregui's are removed so it goes to character and works only if i copy and paste it in the character.
tools = "Bronze Sword" plr = game:GetService("Players") gui = plr.LocalPlayer.PlayerGui function onClick() tool = game:GetService("ReplicatedStorage") tool:FindFirstChild(tools):clone() tool.Parent = plr.LocalPlayer.Character end script.Parent.MouseButton1Down:connect(onClick)
It's saying the Parent
property is locked because you set the tool
variable to ReplicatedStorage
, and the parent of that is Game
. For this to make more sense, I'd do something like this.
toolName = "Bronze Sword" plr = game:GetService("Players").LocalPlayer repStore = Game:GetService("ReplicatedStorage") function onClick() tool = repStore:FindFirstChild(toolName):Clone() tool.Parent = plr.Character -- maybe plr.Backpack? end script.Parent.MouseButton1Down:connect(onClick)