#I'm trying to make a 'Target block' that would indicate where an attack would go before use.

14 messages · Page 1 of 1 (latest)

unique cypress
#

Problem: I'm not sure how to make it go away with this method? It does print the statements, but I'm not sure why it won't delete the part?

local tool = script.Parent

local event = script:WaitForChild("EventConnection")

local Tween_Service = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local player = game.Players.LocalPlayer

local position_target_part = nil

tool.Equipped:Connect(function()
    print("Equipped")
    local position_target_part = ReplicatedStorage.AttackPositionPart:Clone()
    position_target_part.Parent = game.Workspace.Attack_Effects
    
    while position_target_part ~= nil do
        position_target_part.Position = player:GetMouse().Hit.Position
        wait()
    end
end)

tool.Unequipped:Connect(function()
    print("Unequipped")
    position_target_part = nil
end)```
turbid violet
#

In the video you don't unequip the tool do you ?

unique cypress
#

ah mb

#

eitherway

#

when i unequip it stays the same way

#

still following the mouse

copper iron
#

just destroy it

#

@unique cypress

#

tool.Unequipped:Connect(function()
print("Unequipped")
position_target_part:Destroy()
end)

#

ur making a new clone each time u equip anyway

#

u even serviced debris

#

u can also use Debris:AddItem(position_target_part)

unique cypress
#

ah