This tool was to make the player who uses it has a invisible torso, but It only works in studio.
EDIT: Used UserInputService Instead
local Player = Game.Players.LocalPlayer local Char = Player.Character local Mouse = Player:GetMouse() local Torso = Char:FindFirstChild'Torso' enabled = true game:GetService("UserInputService").InputBegan:connect(function(input,proc) if input.KeyCode == Enum.KeyCode.E then if enabled then enabled = false Torso.Transparency = 1 wait(5) Torso.Transparency = 0 enabled = true end end end)
No errors Why won't this tool work in a server?
Tool is a regular tool not requiring a handle and the script is a local script and I've tried a hopperbin
The script appears to be loading before the character and its elements began to load.
I added a wait function to a CharacterAdded event to return the character once the Character was added. The script appears to be loaded and executed before the character can be added. Also, FindFirstChild was returning Torso as nil, so line 3 in the script below can act as a if then statement somewhat. It's basically going if FindFirstChild returns nil, then wait for the WaitForChild to find something.
local Player = game.Players.LocalPlayer local Char = Player.CharacterAdded:wait() local Torso = Char:FindFirstChild'Torso' or Char:WaitForChild'Torso' enabled = true game:GetService("UserInputService").InputBegan:connect(function(input,proc) if input.KeyCode == Enum.KeyCode.E then if enabled then enabled = false Torso.Transparency = 1 wait(5) Torso.Transparency = 0 enabled = true end end end)