Here is what it looks like
Here is what I want it to look like
Local script:
local character = player.Character or player.CharacterAdded:Wait()
local RightArm = character:WaitForChild("Right Arm")
local backpack = player:WaitForChild("Backpack")
local mouse = player:GetMouse()
local cube = game.ReplicatedStorage:WaitForChild("Cube")
local equipped = false
local debounce = true
mouse.Button1Down:Connect(function()
if equipped == true and debounce then
debounce = false
local newPart = cube:Clone()
newPart.Position = RightArm.Position
newPart.CanCollide = false
newPart.Parent = workspace
local hitPosition = mouse.Hit.Position
newPart.CFrame = CFrame.lookAt(newPart.Position, hitPosition)
local LinearVelocity = newPart.LinearVelocity
LinearVelocity.MaxForce = math.huge
LinearVelocity.VectorVelocity= newPart.CFrame.LookVector * 40
wait(.3)
LinearVelocity:Destroy()
wait(.3)
debounce = true
end
end)
character.DescendantAdded:Connect(function(descendant)
if descendant:IsA("Tool") then
equipped = true
print("equipped")
end
end)
character.DescendantRemoving:Connect(function(descendant)
if descendant:IsA("Tool") then
equipped = false
print("unequipped")
end
end)
How would I make it so it can detect when it touches something? I can’t use Touched event in local script. I just honestly don’t really know how to go about this.