Hello! I would like to know what is wrong in my code, I want the night vision tool to appear in the player's head, how can I do that?
01 | local tool = script.Parent |
02 | local equipped = false |
03 | local UID = game:GetService( "UserInputService" ) |
04 |
05 | local player = game.Players.LocalPlayer |
06 | local char = player.Character |
07 | tool = char.Head.CFrame |
08 |
09 |
10 | tool.Equipped:Connect( function () |
11 | equipped = true |
12 | end ) |
13 |
14 | tool.Unequipped:Connect( function () |
15 | equipped = false |
Ok, to start you don't need to use user input service when you're using activated because that automatically detects when the tool is equipped and when it is left-clicked (however if you want other inputs with your tool you should still use User Input Service.) Also is this a server or local script, because you cant use things like ".LocalPlayer" on server scripts so that could be part of your problem.