A simple version of my script (provided by ShawnyG in my last question).
Why does this not work:
torso = game.Players.LocalPlayer.Character.Torso part2 = game.Workspace.Part2 if (torso.Position - part2.Position).magnitude >= 40) then print('It is 40 studs away!!!') end
The script is enabled. There is a LocalScript in the StarterGui. There is a part named "Part2" in the Workspace. There is no output. I'm stumped.
**UPDATE: **I added print("The script is responding")
at line 3, but nothing even prints. I'm even more confused now. This is in a LocalScript in the Workspace.
You have an unmatched parenthesis:
if (torso.Position - part2.Position).magnitude >= 40) then -- ^
Remove it.
This is why nothing printed even at the beginning-- Lua cannot do anything at all if you have a syntax error.
From the wiki: "In order for a LocalScript to function, it must be placed within one of three areas:
-In a player's Backpack (can be indirectly, through a Tool or HopperBin) -In a player's character model -In a player's PlayerGui"
LocalScripts do not run in the workspace, move it to an appropriate place for it to run