Hey How can i Destroy a Part which is welded to the Humanoid via script.
Please be more specific but is this what ur talking about???
local part = -- ur part here
part:Destroy()
-- or
game.Debris:AddItem(part, 0.1)
Yeahi know but i created a Part whit a Module script function
ToolService.Tool(player,"Part","RightHand",10,10,1)-- Partname, Were ist welded, SizeX,SizeY,SizeZ
how can i call this Part and derstroy it
Can you show more of the script idk whats going on here, also what modulke are you using?
Ok so i made a Module script which creates a Part and weld at to a player:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local module = {}
module.Tool = function(player,Tool,limb,X,Y,Z,start,end)
wait(start)
local Toolboi = script.Tools:WaitForChild(Tool):Clone()
local Character = player.Character
local Limb = Character:WaitForChild(limb)
local weld = Instance.new("ManualWeld")
Toolboi.Size = Vector3.new(X,Y,Z)
Toolboi.CFrame = Limb.CFrame
Toolboi.Parent = Character
weld.Part0 = Toolboi
weld.Part1 = Limb
weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
weld.Parent = weld.Part0
wait(ende)
Toolboi:Destroy()
Next i wanted to create the Part if a Variable is true. Which it is . So the Part will be created. And if the Variable is fals again the Part will be desroyed if its there.
local playerData = localdata.Players[player.UserId][1]
if playerData.IronFly.IsIronFlying == true then
print("it true")
ToolService.Tool(player,"Part","RightHand",10,10,1,0,100000)
else
-- what do i whrite her to destroy the part
end
You could create another module function called module.DestroyTool()
and destroy the tool, or move that code into the module and destroy it there.
EDIT: Another way is to create a variable in the module called ‘Part’ or something and call it from the script by going module.Part:Destroy()
etc.