It’s been a hot minute since I coded Roblox Lua. I’m attempting to recreate the Osu gamemode Osu!catch into Roblox. Right now I’m struggling to even make the character movement. I’m trying to make a system where the catcher GUI moves to the right when you press the right arrow key, and the catcher moves to the left when the left arrow key is moved. I can’t get the script to work. What am I doing wrong?
Sounds dumb but is that server script or client script?
Neither. It was on “Legacy”
Its a server
Script as indicated by the header, so that’s why it aint working.
UserInputService works only in
I put the all the code on a local script and it still doesn’t work.
Because you are referencing the gui in
StartGui and not
PlayerGui. The contents of the
StarterGui are automatically copied to the
PlayerGui when the player joins in, and it is the UI in
PlayerGui which is seen by the player.
local player = game.Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local gui = path_to_gui
So I change it to this?
local player = game.Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local gui = game.StarterGui.ScreenGui.Catcher local UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.Right then gui.Position.X.Offset = gui.Position.X.Offset + 0.1 end end)
local gui = playerGui:WaitForChild("ScreenGui"):WaitForChild("Catcher")