Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Summoning handle for tool script not working?

Asked by 6 years ago

So, i'm new to scripting but whipped up a quick tool script, which won't work. I've tried to make it where the handle goes into the tool but it just won't work! The code is

TheTool = Instance.new("Tool", Workspace) TheTool.Name = "Echo" wait(5) TheHandle = Instance.new("Part", Echo) TheHandle.Name = "Handle" local copy = game.Workspace.Echo:Clone() copy.Parent = game.Players.LocalPlayer.Character

Please help!

2
You can only use localplayer in a local script, and can you put your code in a code block so it's easier to read? Viking359 161 — 6y
0
Why not just have the handle already inside the tool? Goulstem 8144 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

I recommend putting the tool itself in ServerStorageor ReplicatedStorage. So what I would do is I would put the tool Echo in ReplicatedStorage. Another thing that you should do is put this in a LocalScript in StarterPack. What this code technically does is gets the tool from ReplicatedStorage, then it clones it to the player Backpack and StarterPack

local toolStorage = game:GetService("ReplicatedStorage")
local tool = toolStorage:WaitForChild("Echo")
local player = game.Players.LocalPlayer
local backpack = player:WaitForChild("Backpack")
local starterPack = game:GetService("StarterPack")
tool:Clone().Parent = backpack
tool:Clone().Parent = starterPack

Please put your code in code block (Press the Lua button, then put your code inside the lines) Please accept my answer if it helped you.

Ad

Answer this question