-
What do you want to achieve?
im not good at scripting and i found this flashlight script/model on youtube and i want to when i unequip flashlight, firstperson model destroy -
What is the issue? my issue is when i unequip flashlight the firstperson model wont disapear, and when i equip the flashlight script making folders in workspace
robloxapp-20240716-2303055.wmv (1.5 MB)
scrip:
local equip_Fpart = game.ReplicatedStorage.flashlight_remote.flashlight_equip
local destroy_Fpart = game.ReplicatedStorage.flashlight_remote.flashlight_destory
local Fpart = game.ReplicatedStorage.Fpart
equip_Fpart.OnServerEvent:Connect(function(plr)
local char = plr.Character
local humanoid = char:FindFirstChild("Humanoid")
local plr_folder = Instance.new("Folder")
plr_folder.Parent = workspace
plr_folder.Name = "w"..plr.Name
local cloned = Fpart:Clone()
cloned.Parent = plr_folder
cloned.Name = plr.Name
local weld = Instance.new("WeldConstraint")
weld.Parent = plr_folder
if humanoid.RigType == Enum.HumanoidRigType.R6 then
print("rig type is r6")
cloned.CFrame = char:FindFirstChild("Right Arm").CFrame * CFrame.new(0,-1,0)
--cloned.Orientation = Vector3.new(0,0,0)
weld.Part0 = cloned
weld.Part1 = char:FindFirstChild("Right Arm")
elseif humanoid.RigType == Enum.HumanoidRigType.R15 then
cloned.CFrame = char:FindFirstChild("RightHand").CFrame * CFrame.new(0,0,0)
--cloned.Orientation = Vector3.new(0,0,0)
weld.Part0 = cloned
weld.Part1 = char:FindFirstChild("RightHand")
end
destroy_Fpart.OnServerEvent:Connect(function(plr)
local g1 = plr_folder:FindFirstChild(plr.Name)
local g2 = workspace:FindFirstChild("w"..plr.Name)
end)
end)