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?
✓ ANSWER ACCEPTED
How do you make a motion detector that shows a gui when detected motion?
1 answer
✓ Accepted answer
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
Please remember to accept my answer!
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Why do you need the while wait(), couldn't you just do the if statement and if Magnitude = 0 then Enabled = false? I feel like that'd be more performance efficient since its not constantly checking, but I'm not the best coder so...
Thanks!
Didn't work