1

# How do you make a motion detector that shows a gui when detected motion?

I've been trying to make games lately and they suck but I just had an idea but I don't know how to script it. Can anybody please help me?

0
local chr = script.Parent -- Get character
local hum = chr:WaitForChild("Humanoid") -- Get humanoid
local plr = game.Players.LocalPlayer

while wait() do
if hum.MoveDirection.Magnitude > 0 then -- Check for motion
plr.PlayerGui.AWrfawf.Enabled = true -- change "AWrfawf" to the ScreenGUI's name
else
plr.PlayerGui.AWrfawf.Enabled = false -- change "AWrfawf" to the ScreenGUI's name
end
end