I’m trying to find a character to make it a cframe to go to the look vector, but it says humanoid root part is nil.
Script:
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local function Move(x,y,z)
for i=1,10 do
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(x,y,z)
wait(0.1)
end
end
script.Parent.Touched:Connect(function()
if Character.HumanoidRootPart ~= nil then
script.Parent.Position = Character.HumanoidRootPart.CFrame.LookVector * 5
Move(1,0.25,0)
Move(1,-0.25,0)
end
end)
end)
end)
Output:
Humanoid is not a valid member of Workspace “Workspace”
Thanks for reading.