Can anyone help me us magnitude

I have a monster and I want it where when u get close to him it turns fog on and when ur not next to him fog turns off

I LIIIVEEEEE

We can’t exactly give you scripts (I’m an exception some of the times), but we can give you examples on how you could implement it

Since you want the fog to enable when the monster is near you, you’d probably need to implement this on a LocalScript via defining the Monster & Character’s HRP

local Lighting = game:GetService("Lighting")

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart")
local Monster = workspace:WaitForChild("MonsterThingymajighere") --Keeping in mind, that this would infinitely yield until a Monster has been found

while true do
    if (HRP.Position - Monster.HumanoidRootPart.Position).Magnitude < 10 then
        Lighting.FogEnd = 10
    else
        Lighting.FogEnd = 50
    end
    wait(.1)
end

You could do something along the lines of this perhaps

1 Like