So I have been having a problem where I made this orb that goes around the player and it activates when you click the left mouse button, but the problem is is that I wanna make the script destroy a specific part that hits it. But it does not do that, please help. Here is the code:
local event = game.ReplicatedStorage.Events.ForcefieldEvent
event.OnServerEvent:Connect(function(player)
local upperTorso = player.Character.UpperTorso
local weld = Instance.new("WeldConstraint",upperTorso)
local cFF = Instance.new("Part",workspace)
cFF.Anchored = false
cFF.CanCollide = false
cFF.Size = Vector3.new(11.87, 11.87, 11.87)
cFF.Shape = "Ball"
cFF.Material = Enum.Material.SmoothPlastic
cFF.Position = upperTorso.Position
weld.Part0 = upperTorso
weld.Part1 = cFF
cFF.Transparency = 0.5
cFF.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("BlueOrb") then
workspace.BlueOrb:Destroy()
else
print("Pass.")
end
end)
end)

1 comment
Do you have a localscript which send Mouse.Target to this script?