This script aint doing of the work

game:GetService(“UserInputService”).InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.LeftControl then
script.Parent.Parent.Bar.Visible = true
end
end)
its supposed to make script.parent.parent visible when left ctrl is pressed but it wont work

1 Like
local Bar = -- Wherever you 'Bar' is located

game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent)
    if gameProcessedEvent then return end

    if input.KeyCode == Enum.KeyCode.LeftControl then
       Bar.Visible = true
    end
end)
1 Like

but it still didnt workkkkkkkkkkk :frowning:

You seem to have the coding correct but I don’t think you are referencing the ‘Bar’ properly. Where is the script you wrote located in the Explorer?

We need a lot more information to do anything about your problem. Any errors? More context? Tell us what doesn’t work? Where is the script located? Is it a localscript? Give us more information dude

no error message, located in the script.parent.parent, not a localscript just a normal one

LocalScripts are the only type of script that should be handling player input.

Can you share a screen shot of where you have this ‘Bar’ and LocalScript located so we can further assist?

mb, it works in a local script ty for helping

1 Like

Then make your reply a solved reply

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.