Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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

0
I already fixed it. I had to define mouse.hit.p not mouse.x. ScriptedEli 101 — 5y
Ad

Answer this question