Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I weld a tool to the player's torso?

How do I weld a tool to a player's torso, I'm trying to make a flashlight tool that doesnt get held in the hand, rather it's a light coming from the player's body like this (https://thief-simulator.fandom.com/wiki/Flashlight?file=Flashlight.jpg), here is my code, it just makes the light at the middle of the map.

local flashlight = script.Parent.light

local player = game.Players.LocalPlayer
local character = game.Workspace:FindFirstChild(player.Name)
    local weld = Instance.new("Weld",flashlight)
weld.Part0 = flashlight    
weld.Part1 = character["Torso"]
weld.C0 = CFrame.new(0, 0, 0) + Vector3.new(0,character["RightHand"].Size.Y/2,0)

1 answer

✓ Accepted answer

Actually, You can just add a light to the player body.

Every single time character is Loaded, you can add Light to the player Torso by using Instance.new()!

For Example:

--Making Part
local Part = Instance.new("Part")
Part.Name = "Part"

Part.Parent = workspace

Solution:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		if not Character.Humanoid:FindFirstChild("Flashlight") then
			local Flashlight = Instance.new("SpotLight")
			Flashlight.Name = "Flashlight"

			--Config
			Flashlight.Angle = 90
			Flashlight.Brightness = 20
			Flashlight.Range = 16
			--End

			Flashlight.Parent = Character.HumanoidRootPart
		end
	end)
end)

Hope It Helps!

4 comments

0

Good solution, upvoted!

0

@Xapelize Thanks!

0

thanks so much!!

0

@Lolbit_exe Np!

This discussion is preserved as it was. New answers, comments, and votes are closed.