Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

X cannot be assigned to? I just need the part to follow the mouse!

Here is my script, I don't know what is up.

local Player = game.Players.LocalPlayer
local Character = Player.Character
local KeyBind = "u"
local Mouse = Player:GetMouse()

function FollowMouse()
	local Target = script.Target:Clone()
	Target.Parent = Character
	Target.Position.X = Vector3.new(Mouse.X,Target.Position.Y,Target.Position.Z)
end

Mouse.KeyDown:Connect(function(Key)
	if Key == KeyBind then
		FollowMouse()
	end
end)

(Fixed) By redoing the variable to Mouse.hit.p instead of Mouse.x it fixed it!

1 answer

✓ Accepted answer

Correct me if I am wrong, but I am pretty sure you need to define what X is to make it work. there isn't a place where you defined it

1 comment

0

I already fixed it. I had to define mouse.hit.p not mouse.x.

This discussion is preserved as it was. New answers, comments, and votes are closed.