Flashlight Not Working as Intended

Why you didnt told me that earlier? :skull:
Ok 1 sec gotta edit the post with fixed code

local EquipFlash = ReplicatedStorage.EquipFlash
local Handle = ReplicatedStorage.FlashHandle
local FL_Name:string = Handle.Name

EquipFlash.OnServerEvent:Connect(function(player:Player, trigger:boolean|any):()
	if type(trigger)~="boolean" then player:Kick("Nasty exploiter") end
	local character:Model? = player.Character
	if character==nil then return end

	if trigger then
		if character:FindFirstChild(FL_Name)~=nil then return end
		local Flashlight:BasePart? = Handle:Clone()
		local Motor6D:Motor6D = Instance.new("Motor6D")
		Motor6D.Part0 = character:FindFirstChild("Right Arm")
		Motor6D.Part1 = Flashlight
		Motor6D.Parent = Flashlight
		Flashlight.Parent = character
		task.wait(.25)
		Flashlight.Transparency = 0
		task.wait(.925)
		Flashlight.Flash.SpotLight.Enabled = true
	else
		local Flashlight:BasePart? = character:FindFirstChild(FL_Name)
		if Flashlight == nil then return end
		Flashlight:Destroy()
	end
end)
1 Like