Thanks you for reading
Hello developers, i’m trying to make a 2D game on roblox without any 3D objects.
I made a 2D movement:
And this is the script:
local World = script.Parent -- This is a screengui
World.IgnoreGuiInset = true
World.Parent = game.Players.LocalPlayer.PlayerGui
local Player = World.Player
-- player's movement
while wait() do
if UIS:IsKeyDown(Enum.KeyCode.D) then
Player.Position = UDim2.new(Player.Position.X.Scale + 0.01,Player.Position.Y.Scale,Player.Position.Y.Scale,Player.Position.Y.Scale)
end
if UIS:IsKeyDown(Enum.KeyCode.A) then
Player.Position = UDim2.new(Player.Position.X.Scale - 0.01,Player.Position.Y.Scale,Player.Position.Y.Scale,Player.Position.Y.Scale)
end
if UIS:IsKeyDown(Enum.KeyCode.W) then
Player.Position = UDim2.new(Player.Position.X.Scale,Player.Position.Y.Scale,Player.Position.Y.Scale - 0.02,Player.Position.Y.Scale)
end
if UIS:IsKeyDown(Enum.KeyCode.S) then
Player.Position = UDim2.new(Player.Position.X.Scale,Player.Position.Y.Scale,Player.Position.Y.Scale + 0.02,Player.Position.Y.Scale)
end
end
----------------------------------------------
-- Camera?
-------------------
Now, i don’t know how to make a camera that follows the player which is the “Red cube”
If you guys need more info, tell me. Have a nice day