I added a script inside the Handle and typed:
script.Parent.Name = '_'
wait(2)
script.Parent.Name = 'Handle'
But, it still was attached to my hand. Why is that?
I added a script inside the Handle and typed:
script.Parent.Name = '_'
wait(2)
script.Parent.Name = 'Handle'
But, it still was attached to my hand. Why is that?
Make sure the you make a spawnLocation so you'll spawn at the ground, otherwise the tool will spawn in the air, unless you want it to do that then it's your choice.
-- This script is a normal script, inside StarterPack, i think it doesn't really matter where it is, just make sure it's in a location where normal scripts are acceptable to run.
-- Make sure to put the tool in "ReplicatedStorage"
local tool = game.ReplicatedStorage.Tool:Clone() -- cloning the part, and set the cloned part to be a variable
wait(3) -- Making sure the player has loaded in before the script runs, (You can do this an alternative way with :LoadCharacter().
tool.Parent = game.Workspace
tool.Handle.Position = game.Workspace:WaitForChild("YOUR NAME HERE").HumanoidRootPart.Position + Vector3.new(0,0,-5) -- ating the tool's cloned position to your position, and then offsetting it from the z axis to make sure you won't automatically pick it up, intead it's in front of you.
wait(2)
tool.Handle.Position = game.Workspace:WaitForChild("YOUR NAME HERE").HumanoidRootPart.Position -- Setting the tool's cloned position to your absolute position.
-- Therefore you will automatically be equipping the tool.
-- There's a much efficient way of doing this, but to keep it simple, this is the most simple way of doing it.
You don't have to wait, you can time it perfectly by typing "game.Players.PlayerAdded:Connect(function(player --[[ Instead of saying "YOUR NAME HERE", you can just type "player.Name" ]])" and then it auto puts "end)" then put alllll that code into there
Sorry, but this unefficient and not simple. I understand now, but there are better ways. Sorry :l It works, but I will improve it.
I understand, i tried doing game.Players.PlayerAdded:Connect(function(player), but that didn't seem to run the code correctly, but glad i could atleast try to help!
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
Are you using a local script?
No, a server script :l
Any errors? is that the full code?
yes