Im trying to make a script where when you press any button on your keyboard the GUI colapses and you just proceed in the game. Everything works properly when im testing in “roblox studio” but when i play the game from roblox game nothing works. Here are my scripts.
local GUI = script.Parent
local userinputservice = game:GetService("UserInputService")
userinputservice.InputBegan:Connect(function(input, gameProcessedEvent)
game.ReplicatedStorage.RemoteEventPressAnyKeyToStartTheGame:FireServer()
if input.UserInputType == Enum.UserInputType.Keyboard then
print("Player has pressed keyboard")
end
end)
-- This is localscript and their direct parent is StarterScreenGUI
game.ReplicatedStorage.RemoteEventPressAnyKeyToStartTheGame.OnServerEvent:Connect(function()
player.PlayerGui.StarterScreenGUI:Destroy()
print("Event fired")
end)
--This was a script in ServerScriptService
EDIT :
So my server script right now is the “PressAnyKeyToStartTheGameServerScript”
And my local script is the “StarterKeyboardInputScript” (Forgot to clarify in renaming its a localscript)
Absolutely agree. Debugging is extremely helpful and I learnt to do that instead of asking on the DevForum all the time, altough not everyone is aware of how to properly debug their scripts.
Exactly, I am suprised how little scripters know this as it can be so helpful whist finding bugs and errors. I will make an in-detail post about debugging now and I will link it here later.
Oh, it doesn’t print them? Then that means the LocalScript isn’t working at all. Can you send me the hierarchy of game please? Or at least the part with the LocalScript.
Basically my localscript is right after StarterGui and inside of localscript its just all the GUI things like frames, logos, labels if you check out my profile you can see how exactly my GUI looks.
i think you should delete the GUI by using serverscript, try to trigger the server by putting it into the if statement in localscript and proceed to delete the GUI from server