This might not be the good place to post this but I don't know how I would find a targerts humanoidsrootpart, any suggestions?
For example for such code
local humanoidRootPart = Player.Character.HumanoidRootPart local targetRootPart = (I am stuck here).HumanoidRootPart
Thanks
A ServerScript cannot get a player's mouse, therefore this would not work. What you would have to do is insert a LocalScript into StarterPlayer > StarterPlayerScripts and insert the following code:
local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local localPlayer = Players.LocalPlayer local mouse = localPlayer:GetMouse() local function inputBegan(input, gameProcessed) if input.UserInputType == Enum.UserInputType.MouseButton1 and mouse.Target.Parent ~= localPlayer.Character then if Players:GetPlayerFromCharacter(mouse.Target.Parent) or mouse.Target.Parent:FindFirstChild("Humanoid") then local targetCharacter = mouse.Target.Parent local huamonidRootPart = targetCharacter:WaitForChild("HumanoidRootPart") -- Got the HumanoidRootPart. end end end UserInputService.InputBegan:Connect(inputBegan)
Note that this only works for a player's character, not NPC's.