This might not make sense, but i've made a LocalScript that basically makes an ImageLabel controllable by the player. (Using WASD) What I need is a script that makes a Frame (ImageLabel, etc.) impossible to pass through. For example, you cannot go past the left side of the screen in Super Mario Bros. Here is the code:
wait(0.1)
local runservice = game:GetService("RunService")
local position2 = game.Players.LocalPlayer.PlayerGui.ScreenGui.ImageLabel
runservice.RenderStepped:connect(function()
if script.Up.Value == true then
position2.Left.Disabled = true
position2.Right.Disabled = true
position2.Down.Disabled = true
position2.Up.Disabled = false
position2.Position = position2.Position + UDim2.new(0,0,-0.0025,0)
end
if script.Down.Value == true then
position2.Left.Disabled = true
position2.Right.Disabled = true
position2.Down.Disabled = false
position2.Up.Disabled = true
position2.Position = position2.Position + UDim2.new(0,0,0.0025,0)
end
if script.Right.Value == true then
position2.Left.Disabled = true
position2.Right.Disabled = false
position2.Down.Disabled = true
position2.Up.Disabled = true
position2.Position = position2.Position + UDim2.new(0.0025,0,0,0)
end
if script.Left.Value == true then
position2.Left.Disabled = false
position2.Right.Disabled = true
position2.Down.Disabled = true
position2.Up.Disabled = true
position2.Position = position2.Position + UDim2.new(-0.0025,0,0,0)
end
end)
Here is the game if more info is needed: https://www.roblox.com/games/3481420494/frisk-moving-test

3 comments
thank you for an actual answer.
This confused me at first, but i now understand it.
Sorry. Explaining stuff isnt my specialty. Glad it was of some use.