So I playing around with mouse.Hit.p
and found that I could move a part…that could move me. Why is this possible? How do I prevent this from moving my character?
robloxapp-20210422-1235118.wmv (1.6 MB)
Sorry about video quality!
Here is the script:
repeat wait() until game.Players.LocalPlayer.Character
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local mouse = player:GetMouse()
local runService = game:GetService("RunService")
local yOffset = Vector3.new(0, 3, 0)
local part = Instance.new("Part")
part.Position = Vector3.new(0, 1, 0)
part.Anchored = true
part.Size = Vector3.new(2,2,2)
part.Color = Color3.fromRGB(53, 255, 225)
part.Parent = game.Workspace
runService.RenderStepped:Connect(function()
part.Position = mouse.Hit.p + yOffset
end)