Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My magnitude refuses to print() when a certain magnitude is reached. Help?

Here is the section of my code:

local Player = game.Players.LocalPlayer
local Door = game.Workspace.Door1
local SetDistance = 10
if (Door.Position - Player.Character.Head.Positon).Magnitude < SetDistance then

I am inexperienced to magnitude so this is new, however it is refusing to print atleast once.

This is worspace>localscript

I don't like to use script helper unless if its a last resort, however I make stupid mistakes in my script that I cannt identify.

5 comments

0

Or its just properties, eitherway I need help.

0

could you show us more of the code

0

No, because thats all thats needed, its not a problem with the rest of the code.

0

because after this its suppose to "print", and its near the beginning where I list all of my possible variables.

0

there is no print

3 answers

✓ Accepted answer

Is the localscript located in the workspace ? if it is then the localscript wont run

see this article

1 comment

0

Oh sorry, your right, It was just properties, I usually code when I'm tired and make alot of mistakes. sorry for not upvoting your answer.

The only problem I noticed is that you misspelled Position, instead it was 'positon'.

local Player = game.Players.LocalPlayer
local Door = game.Workspace.Door1
local SetDistance = 10
if (Door.Position - Player.Character.Head.Position).Magnitude < SetDistance then
	-- Do stuff
end

Firstly the local script is in the workspace, local scripts do not function in the workspace

And secondly you did not tell it to print anything

1 comment

0

I did, I just felt like it wasn't important to leave in the segment of the script, because I said it was to print something. So their was no reason to.

This discussion is preserved as it was. New answers, comments, and votes are closed.