I’ve been trying to make the players arm follow the mouse with a local script, but it only works well if the player has a tool out. And I don’t want to have to give a player a tool every time they press E because they can just unequip it.
Here is the script:
local UserInputService = game:GetService(“UserInputService”)
local hole = script.Parent:WaitForChild(“RightArmWeld”).Piece
local debris = game:GetService(“Debris”)
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local nweld = script.Parent.Torso[‘Right Shoulder’]
local arm = script.Parent:WaitForChild(“Right Arm”)
oldC0 = nweld.C0
nweld.CurrentAngle = 0
nweld.DesiredAngle = 0
nweld.MaxVelocity = 0
local equipped = false
UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.E then
equipped = true
while equipped do
local tframe = script.Parent.Torso.CFrame
tframe = tframe + tframe:vectorToWorldSpace(Vector3.new(1, 0.5, 0))
local taim = mouse.Hit.p -( tframe.p )
nweld.C0 = (CFrame.new(Vector3.new(),tframe:vectorToObjectSpace(taim))*CFrame.Angles(0,math.pi/2,0))+Vector3.new( 1, 0.5, 0 )
wait()
end
end
end)
UserInputService.InputEnded:Connect(function(input,gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.E then
equipped = false
nweld.MaxVelocity = .15
nweld.C0 =oldC0
end
end)
Thank you for reading. Sorry if the answer is obvious or complex!