alright i'm stuck on this i don't know a lot of lua but this is the script i have so far (its in a localscript in starterpack)
function Keypress(input, gameProcessed) if input.KeyCode == Enum.KeyCode.T then game.Workspace.Entity_246.Head.Transparency = 0 else game.Workspace.Entity_246.Head.Transparency = 1 end end game:GetService("UserInputService").InputBegan:Connect(Keypress)
Thanks for reading
Edit: Also any way to make this local player? i mean like instead of One user its the user who presses t? thanks!
This might work for you; here is some code I just thought up, so try it out. (localscript)
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local object = workspace.Entity_246.Head mouse.KeyDown:connect(function(key) if key == "t" then --Key of your choice. print("Pressed t") object.Transparency = 1 --Set transparency to 1. end if key == "r" then --Key of your choice. print("Pressed r") object.Transparency = 0 --Set transparency to 0. end end)
Hope this works, (this might not be exactly what you wanted) feel free to modify this to your use if so.
If you want the localplayer's head to go invisible on keypress, then consider this:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.KeyDown:connect(function(key) if key == "t" then --Key of your choice. print("Pressed t") player.Character.Head.Transparency = 1 --Set transparency to 1. end if key == "r" then --Key of your choice. print("Pressed r") player.Character.Head.Transparency = 0 --Set transparency to 0. end end)
Merry Christmas! :)