if input.UserInputType == Enum.UserInputType.Keyboard then
local Image = script.Parent.Parent.ImageLabel
if input.UserInputType == Enum.KeyCode.B then
local Image = script.Parent.Parent.ImageLabel.ImageTransparency = 0
then
local Image = script.Parent.Parent.ImageLabel.ImageTransparency = 1
end*
local userInputService = game:GetService("UserInputService")
userInputService.InputBegan:Connect(function(input,gp)
if gp then return end
if input.KeyCode== Enum.Keycode.B then
local Image = script.Parent.Parent.ImageLabel
Image.ImageTransparency = (Image.ImageTransparency == 0) and 1 or 0
end
end
UserInpuType is the type of Input Device you use such as mouse button,keyboard so you need to ask for
input.KeyCode
and I think your trying to make it so if you press B it makes it visible but if you press something else it makes it transparent (thats what im getting off this)
you need to restructure your if statement to like this
if .. then
elseif ... then
else
end
so in here you’d go like this
local Image = script.Parent.Parent.ImageLabel
-- you declare your stuff first
if input.KeyCode == Enum.KeyCode.B then
Image.ImageTransparency = 0
else
Image.ImageTransparency = 1
end
local userInputService = game:GetService(“UserInputService”)
userInputService.InputBegan:Connect(function(input,gp)
if gp then return end
local Image = script.Parent.Parent.ImageLabel
if input.KeyCode == Enum.KeyCode.B then
Image.ImageTransparency = 0
wait(3) else
Image.ImageTransparency = 1
end
end)
local userInputService = game:GetService('UserInputService')
userInputService.InputBegan:Connect(function(input, typing)
if typing then return end
local Image = script.Parent.Parent.ImageLabel
if input.KeyCode == Enum.KeyCode.B then
Image.ImageTransparency = 0
task.wait(3)
Image.ImageTransparency = 1
end
end)