of     1   

CardsOfFate
#182973004Thursday, February 04, 2016 4:39 AM GMT

local part = game.ReplicatedStorage.TheBrick:Clone() local mouse = game.Players.LocalPlayer:GetMouse() mouse.Move:connect(function() if mouse.Target then if mouse.Target.Name == "HOVER_TRUE" then part.Parent = game.Workspace part.Position = mouse.Hit.p part.Transparency = 0.5 else if mouse.Target.Name ~= part.Name then part:remove() end end end end) This error will occasionally pop up: attempt to index field 'Target' (a nil value) is their a way to prevent this?
CardsOfFate
#182973353Thursday, February 04, 2016 4:45 AM GMT

bump..
70o11
#182973772Thursday, February 04, 2016 4:54 AM GMT

Try this: local part = game:GetService("ReplicatedStorage"):FindFirstChild("TheBrick"):Clone() local player = game:GetService("Players") local mouse = player:GetMouse() local pos = mouse.Hit.p mouse.Move:connect(function() if mouse.Target then if mouse.Target.Name == "HOVER_TRUE" then part.Parent = game:GetService("Workspace") part.Position = pos part.Transparency = 0.5 else if mouse.Target.Name ~= part.Name and "HOVER_TRUE" then part:remove() end end end) Either the above should work or Target is not a property and Target is not a variable.
CardsOfFate
#182976036Thursday, February 04, 2016 5:50 AM GMT

GetMouse is not a valid member of Players
CardsOfFate
#182976214Thursday, February 04, 2016 5:55 AM GMT

Oh.. I fixed it.. This error still occurs though: Players.Player1.Backpack.LocalScript:12: attempt to index field 'Target' (a nil value) It is not a constant error, the script still works its just I'd rather not have an error being broadcasted randomly
CardsOfFate
#182977321Thursday, February 04, 2016 6:34 AM GMT

bump
eleye
#182981107Thursday, February 04, 2016 11:21 AM GMT

"(a nil value)" you haven't given "Target" a variable
Hedr0n
#182982358Thursday, February 04, 2016 12:34 PM GMT

You're a idiot shriek. Op this happens when the mouse hits nothing for 1000 units of distance. However your problem specifically is your moving the mouse so fast than from where it checked if mouse moved and if mouse.target and where it is now is no longer true. Use user input service and you'll see this problem go away. In other works use uis or Target If mouse.target then Target = Mouse.Target
Hedr0n
#182982460Thursday, February 04, 2016 12:39 PM GMT

Actually do something like this Tar = Mouse.Target if Tar then --- do stuff end
CardsOfFate
#182989866Thursday, February 04, 2016 5:35 PM GMT

local part = game:GetService("ReplicatedStorage"):FindFirstChild("TheBrick"):Clone() local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse() local pos = mouse.Hit.p local Tar = mouse.Target mouse.Move:connect(function() if Tar then if Tar.Name == "HOVER_TRUE" then part.Parent = game:GetService("Workspace") part.Position = pos part.Transparency = 0.5 else if Tar.Name ~= part.Name and "HOVER_TRUE" then part:remove() end end end end) No errors but it's not doing what its post to do.
CardsOfFate
#182990112Thursday, February 04, 2016 5:44 PM GMT

Well, It's not actually doing ANYTHING if I'm being honest.
CardsOfFate
#182990971Thursday, February 04, 2016 6:14 PM GMT

bump..
CardsOfFate
#182996728Thursday, February 04, 2016 8:33 PM GMT

double bump..
ray_revenge
#182997008Thursday, February 04, 2016 8:38 PM GMT

@otherppl You do not seem to fully understand Lua, mouse.Hit.p is a value, and does not reference the actual property. mouse.Target references the current Target, but not the property. Also, "HOVER_TRUE" will always evaluate to true.
CardsOfFate
#182997432Thursday, February 04, 2016 8:46 PM GMT

Well uh- I'm here to learn haha. So whats wrong with this? local part = game.ReplicatedStorage.TheBrick:Clone() local mouse = game.Players.LocalPlayer:GetMouse() mouse.Move:connect(function() if mouse.Target then if mouse.Target.Name == "HOVER_TRUE" then part.Parent = game.Workspace part.Position = mouse.Hit.p part.Transparency = 0.5 else if mouse.Target.Name ~= part.Name then part:remove() end end end end) I make it check the target but the an error can still come up saying the target does not exist?
CardsOfFate
#182997520Thursday, February 04, 2016 8:48 PM GMT

local part = game.ReplicatedStorage.TheBrick:Clone() local mouse = game.Players.LocalPlayer:GetMouse() mouse.Move:connect(function() if mouse.Target then if mouse.Target.Name == "HOVER_TRUE" then part.Parent = game.Workspace part.Position = mouse.Hit.p part.Transparency = 0.5 else if mouse.Target then if mouse.Target.Name ~= part.Name then part:remove() end end end end end) Fixed it.. I just had to make sure the 'else' checked for Target too.

    of     1