Hello, devs!
I was doing tool that changes gui text when you will click at any object, but while trying to change the gui text with the mouse.Target, it said that you can't use mouse.Target, you need to use string. Can someone please explain me how to make that work?
CODE:
script.Parent.Equipped:Connect(function(mouse)
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true
mouse.Button1Down:Connect(function()
print(mouse.Target)
game.Players.LocalPlayer:WaitForChild("PlayerGui"):FindFirstChild("ScreenGui"):FindFirstChild("Frame"):FindFirstChild("TextLabel").Text = mouse.Target
end)
end)
script.Parent.Unequipped:Connect(function()
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false
end)
ERRORS:
Players.ErktikyYT.Backpack.Tool.LocalScript:2: invalid argument #3 (string expected, got Instance)
Line 5
So at the end of the line 5. This is my problem.

2 comments
Did you try using mouse.Target.Name?
It worked, but when I press on sky (nil) then it shows error on output.