How to make a Part face the mouse

not exacly but very close, let me just show you, and then youll see what i mean
robloxapp-20220823-1709309_Trim.wmv (322.5 KB)

well if this is what you’re looking for, then heres the script for it.

--wait(1)
local part = script.Parent
local mouse = game:GetService("Players").LocalPlayer:GetMouse()

part.Parent.Activated:Connect(function()
	local laser = game.ReplicatedStorage.Laser:Clone()
	laser.Parent = workspace
	laser.Size = Vector3.new(1,1,(part.Position-mouse.Hit.Position).Magnitude)
	laser.Position = part.Position
	laser.CFrame = CFrame.lookAt(part.Position,mouse.Hit.Position)
	laser.Position += laser.CFrame.LookVector * laser.Size.Z/2
	wait(0.5)
	laser:Destroy()
end)



isnt that exactly what you showed me before? the video i sent is what i have, i need what it summons to face the mouse

OHHHHHHHHHH You want the ghosty thingy to face the mouse, my bad my bad im sorry, I get it now.
Well I suppose you could use one of the scripts that I gave you, like the model one.
Or you could do this. If

local debounce = false
local cooldown = 2
script.Parent.Activated:Connect(function(player,value)
	if debounce == false then
		spawn(function()
			debounce = true
			local GB = script.Parent.GasterBlaster:Clone()
			GB.Parent = workspace
			GB:SetPrimaryPartCFrame(script.Parent.Parent.HumanoidRootPart.CFrame * CFrame.new(3, 3, 0)) -- you dont need spawn function, i dont think
			local MousePos = script.Parent:WaitForChild("gg").Value
			GB:PivotTo(CFrame.lookAt(GB.PrimaryPart.Position,MousePos) -- first position is the origin, second is what you want it to look at
			GB:WaitForChild("Destroy").Disabled = false
			GB:WaitForChild("Shoot").Disabled = false
			GB:WaitForChild("Creator").Value = script.Parent.Parent
				wait(cooldown)
			debounce = false
		end)
	end
end)

You might have to fix some punctuation errors, i didnt edit this in studio

1 Like

ok, so it works, but for some reason now its looking at some random point instead of the mouse, but i think thats just the script i use to find the mouse, ill review it, thanks for your services.
ok, so it wasnt that, the script to detect is alright, so i dont understand what is going on

1 Like

after a bunch of testing i can safely say, none of the scripts you have given me work, but its because gg doesnt get the value for some reason

Hi, could you re explain your issue for me.

well, I have discovered that, for some reason, gg (a vector3 value) doesnt get the position of my mouse, and i need it to make my model face my mouse,.

Use a remote event to replicate this

Can you specify? I don’t understand what you mean.

I think this should work.

character = – character here
part = – part here
mousepos = – mouse position
part.Orientation = character.HumanoidRootPart.CFrame.LookVector - mousepos

No, no, that’s not the issue, the issue is that the way i use to get the mouse position doesnt work

local players = game:GetService("Players")

local runService = game:GetService("RunService")

local client = players.LocalPlayer

local mouse = client:GetMouse()

local tool = script.Parent

local equipped = false

tool.Equipped:Connect(function()

equipped = true

end)

tool.Unequipped:Connect(function()

equipped = false

end)

while equipped == true do

wait(0.3)

tool:WaitForChild("gg").Value = mouse.Hit.Position

end