Hi! I am trying to make a part follow the player’s mouse with renderstepped(), but the part always zooms into the screen.
Here’s a video of whats happening exactly.
https://gyazo.com/4f447f7bb2ed05140a7808b02a30c8ba
script:
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local localPlayer = Players.LocalPlayer
local part = script.Parent:WaitForChild("light"):Clone()
part.Parent = game.Workspace
local mouse = localPlayer:GetMouse()
RunService.RenderStepped:Connect(function()
local character = localPlayer.Character
if not character then
part.PointLight.Enabled = false
return
end
local head = character:FindFirstChild("Head")
if not head then
part.PointLight.Enabled = false
return
end
part.PointLight.Enabled = true
local lightPos = mouse.Hit.Position
part.Position = lightPos
end)