Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My Script to destory a gui when player is using a keyboard is not working?

So my script that destroy's a gui for mobile users isn't doing what its meant to do

local UserInputService = game:GetService("UserInputService")
 
if (UserInputService.KeyboardEnabled) then
script.Parent.Parent.Parent.MobilGui:Destroy()
end

1 comment

1

Instead of using script.Parent.Parent.Parent place the local script as the child of MobilGui

1 answer

For first, you can put UserInputService.KeyboardEnabled == true is better. and put the scripts with child of GUI

and use this: script.Parent:Destroy()

In my point of view, your script is perfect just need to do these things

Here is the script:

local UserInputService = game:GetService("UserInputService")

wait()

if UserInputService.KeyboardEnabled == true then
	script.Parent.MobilGui:Destroy()
end

Hope it helped! :) Errors? tell-me on comments.

1 comment

0

y do u need a wait()

This discussion is preserved as it was. New answers, comments, and votes are closed.