so, i want to make a top-down game in roblox made only with gui’s, and i made so the player can move, but how would i make so the player collides the walls?
this is what my gui looks like
i didn’t made any code cuz idk where to start with, but i do have a movement script, and it looks like this
local uis = game:GetService("UserInputService")
local plr = script.Parent.Bg.Plr
local spd = 10
local cd = .3
uis.InputBegan:Connect(function(input, processed)
if not processed then
if input.KeyCode == Enum.KeyCode.W then
repeat
plr.Position += UDim2.new(0, 0, 0, -spd)
task.wait(cd)
until not uis:IsKeyDown(Enum.KeyCode.W)
end
if input.KeyCode == Enum.KeyCode.A then
repeat
plr.Position += UDim2.new(0, -spd, 0, 0)
task.wait(cd)
until not uis:IsKeyDown(Enum.KeyCode.A)
end
if input.KeyCode == Enum.KeyCode.S then
repeat
plr.Position += UDim2.new(0, 0, 0, spd)
task.wait(cd)
until not uis:IsKeyDown(Enum.KeyCode.S)
end
if input.KeyCode == Enum.KeyCode.D then
repeat
plr.Position += UDim2.new(0, spd, 0, 0)
task.wait(cd)
until not uis:IsKeyDown(Enum.KeyCode.D)
end
end
end)