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

How do I use Mouse Target?

Asked by 10 years ago
mouse = game.Players.LocalPlayer:GetMouse()

while wait() do
Target = mouse.Target
if Target.Lootable.Value == true then
print "Lootable"
elseif Target.Lootable == nil then end
end

Output: "Lootable is not a valid member" Lootable is a BoolValue

How do I get it to work?

2 answers

Log in to vote
0
Answered by 10 years ago

Um. You cannot directly go to a value in the target here

mouse = game.Players.LocalPlayer:GetMouse()

while wait() do
Target = mouse.Target
if Target:FindFirstChild("Lootable") then
if Target.Lootable.Value == true then
print("Lootable")
elseif not Target:FindFirstChild("Lootable") then 
print("Ended")
end
end
end
0
It said Lootable not valid member due to it didn't find it on first target so the script got disconnected (A.K.A Kinda like disabled) So you have to make sure it is found before you continue rest of script. fireboltofdeath 635 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Thanks, I appreciate the help but it says that is still nil at line 6

Answer this question