[!] sorry if my grammar kinda sucks, I’m really tired at this point from this bug, I decided to just post it here.
so, basically, i have an interaction system with some hands, and uh… it’s not working? I tried everything I could think of and it does not work;
--# Interaction System
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid : Humanoid = Character:WaitForChild("Humanoid")
local Camera = workspace.CurrentCamera
local Viewport = Camera:WaitForChild("Viewport")
local LeftArm : BasePart = Viewport:WaitForChild("LeftUpperArm")
local CurrentClone = nil
local function Start()
local function BeginRaycast()
local Origin = LeftArm.Position
local Direction = LeftArm.CFrame.LookVector * 10
local Parameters = RaycastParams.new()
Parameters.FilterDescendantsInstances = { Viewport }
Parameters.FilterType = Enum.RaycastFilterType.Blacklist
local Result = workspace:Raycast(Origin, Direction, Parameters)
if Result then
local HitInstance = Result.Instance
if HitInstance and HitInstance:IsA("BasePart") and HitInstance:FindFirstChild("Interactable") or HitInstance and HitInstance:IsA("UnionOperation") and HitInstance:FindFirstChild("Interactable") then
return HitInstance
elseif HitInstance and HitInstance:IsA("BasePart") and HitInstance.Parent.Name:lower():find("door") then
return {[1] = HitInstance}
else
return nil
end
else
return nil
end
end
local Object = BeginRaycast()
--# Hold our items
if Object then
if type(Object) == "table" then
local Door = Object[1].Parent
if Door.Door.CFrame == Door.OpenDoor.CFrame then
Door.Door.CFrame = Door.ClosedDoor.CFrame
else
Door.Door.CFrame = Door.OpenDoor.CFrame
end
else
script.Parent.CurrentlyHolding.Value = Object
local clone = Object:Clone()
CurrentClone = clone
clone.Name = "HoldingClone"
clone.Parent = Viewport
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = clone
Weld.Part1 = LeftArm
Weld.Parent = LeftArm
game.ReplicatedStorage.MockDestroy:FireServer(Object)
end
end
end
local function End()
--# Stop holding any items
local target = nil
local cframe = nil
if LeftArm:FindFirstChild("WeldConstraint") then
local targeta = LeftArm:FindFirstChild("WeldConstraint").Part0
LeftArm:FindFirstChild("WeldConstraint"):Destroy()
cframe = targeta.CFrame
targeta:Destroy()
target = game.ReplicatedStorage.UndoMockDestroy:FireServer(script.Parent.CurrentlyHolding.Value.Name)
end
if target then
game.ReplicatedStorage.MoveInteractableToPosition:FireServer(script.Parent.CurrentlyHolding.Value, CurrentClone.CFrame)
script.Parent.CurrentlyHolding.Value = nil
CurrentClone = nil
end
end
Mouse.Button1Down:Connect(Start)
Mouse.Button1Up:Connect(End)
(this is all in a local script)