there is no way the script i gave you doesn’t work i tested it and it works there must be a problem with your goggles
Is a mesh, see the MainServer Script for how it works.
Screenshot the goggles tool and the children too
Bruh in the desc of the forum but ok
Are you sure the Goggles are in the Player ? I think the Googles are in a tool that are in the character of the player
Try this :
script.Parent.NVE.Parent = game.Lighting
local NVE = game.Lighting:WaitForChild("NVE")
local Tool = script.Parent
local Queso = true
local Player = script.Parent.Parent
local Goggles = Player:FindFirstChild("NightVision").Goggles1
Tool.Activated:Connect(function()
if Queso == true then
Queso = false
NVE.Enabled = true
else
NVE.Enabled = false
Queso = true
end
end)
local function IsInFirstPerson()
if game.Players.LocalPlayer.CameraMinimumZoomDistance <= 0.5 then
Goggles.Transparency = 1
else
Goggles.Transparency = 0
end
end
while true do
wait(0.1)
IsInFirstPerson()
end
script.Parent.NVE.Parent = game.Lighting
local NVE = game.Lighting:WaitForChild("NVE")
local Tool = script.Parent
local Queso = true
local Player = script.Parent.Parent
local PlayerHead = Player.Head
local Goggles = script.Parent.Goggles1
Tool.Activated:Connect(function()
if Queso == true then
Queso = false
NVE.Enabled = true
else
NVE.Enabled = false
Queso = true
end
end)
PlayerHead:GetPropertyChangedSignal('LocalTransparencyModifier'):Connect(function()
Goggles.Transparency = PlayerHead.LocalTransparencyModifier
end)
try this
The same problem of the videos that I have sent, there is no result.
A local from the script does not works… I edited the script and now is working again
script.Parent.NVE.Parent = game.Lighting
local NVE = game.Lighting:WaitForChild("NVE")
local Tool = script.Parent
local Queso = true
local Player = script.Parent.Parent
local PlayerHead = Player:FindFirstChild("Head")
local Goggles = Player:FindFirstChild("Goggles1")
Tool.Activated:Connect(function()
if Queso == true then
Queso = false
NVE.Enabled = true
else
NVE.Enabled = false
Queso = true
end
end)
I figured 2 problems with your script and fixed them
- The tool isn’t inside the character at first its actually in the backpack So you doing
local Player = script.Parent.Parent
you’re actually referring to the backpack
changed that togame.Players.LocalPlayer.Character
- The Goggles aren’t always there so you need to create the variable inside of the PropertyChanged Function
Anyway here is the final script :
script.Parent.NVE.Parent = game.Lighting
local NVE = game.Lighting:WaitForChild("NVE")
local Tool = script.Parent
local Queso = true
local localPlayer = game:GetService("Players").LocalPlayer
local Player = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local PlayerHead = Player:WaitForChild("Head")
Tool.Activated:Connect(function()
if Queso == true then
Queso = false
NVE.Enabled = true
else
NVE.Enabled = false
Queso = true
end
end)
PlayerHead:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
local Goggles = Player:FindFirstChild("Goggles1")
if Goggles then
Goggles.Transparency = PlayerHead.LocalTransparencyModifier
end
end)
Wait a minute, Can you add that the activate also works? It’s so that if the player is already in first person, it works too.
script.Parent.NVE.Parent = game.Lighting
local NVE = game.Lighting:WaitForChild("NVE")
local Tool = script.Parent
local Queso = true
local localPlayer = game:GetService("Players").LocalPlayer
local Player = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local PlayerHead = Player:WaitForChild("Head")
Tool.Activated:Connect(function()
if Queso == true then
Queso = false
NVE.Enabled = true
local Goggles = Player:WaitForChild("Goggles1")
Goggles.Transparency = PlayerHead.LocalTransparencyModifier
else
NVE.Enabled = false
Queso = true
end
end)
PlayerHead:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
local Goggles = Player:FindFirstChild("Goggles1")
if Goggles then
Goggles.Transparency = PlayerHead.LocalTransparencyModifier
end
end)
Use RunService.RenderStepped() and bind thy function inside the event. Use :
game["Run Service"].RenderStepped(Connect(function(dt)
if distance <= 1 then -- change this check to the function that check the magnitude of camera.CFrame.Position and character.Head.Position
if Goggles == nil then return end
Goggles.LocalTransparencyModifier = 0
end
end)
Final Script:
MainClient:
script.Parent.NVE.Parent = game.Lighting
local NVE = game.Lighting:WaitForChild("NVE")
local Tool = script.Parent
local Queso = true
local localPlayer = game:GetService("Players").LocalPlayer
local Player = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local PlayerHead = Player:WaitForChild("Head")
Tool.Activated:Connect(function()
if Queso == true then
Queso = false
NVE.Enabled = true
local Goggles = Player:WaitForChild("Goggles1")
Goggles.Transparency = PlayerHead.LocalTransparencyModifier
else
NVE.Enabled = false
Queso = true
end
end)
print(PlayerHead)
PlayerHead:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
local Goggles = Player:FindFirstChild("Goggles1")
if Goggles then
Goggles.Transparency = PlayerHead.LocalTransparencyModifier
end
end)
@Fimutsuu Solved this problem, credits to him!
Hey, why when player dies the script stop working?
Hey! mb i didn’t account for the player dying you will need to update the character and head variable every time the player respawns :
script.Parent.NVE.Parent = game.Lighting
local NVE = game.Lighting:WaitForChild("NVE")
local Tool = script.Parent
local Queso = true
local localPlayer = game:GetService("Players").LocalPlayer
local Player = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local PlayerHead = Player:WaitForChild("Head")
localPlayer.CharacterAdded:Connect(function(char)
Player = char
PlayerHead = Player:WaitForChild("Head")
PlayerHead:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
local Goggles = Player:FindFirstChild("Goggles1")
if Goggles then
Goggles.Transparency = PlayerHead.LocalTransparencyModifier
end
end)
end)
Tool.Activated:Connect(function()
if Queso == true then
Queso = false
NVE.Enabled = true
local Goggles = Player:WaitForChild("Goggles1")
Goggles.Transparency = PlayerHead.LocalTransparencyModifier
else
NVE.Enabled = false
Queso = true
end
end)
PlayerHead:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
local Goggles = Player:FindFirstChild("Goggles1")
if Goggles then
Goggles.Transparency = PlayerHead.LocalTransparencyModifier
end
end)
It doesn’t work , Have you tried it in the studio and everything else?
If it doesn’t work, it will be because the MainServer creates things inside the player and when they die they disappear without finding them.
Yes i tried it on studio and it worked and i’m aware MainServer script clones a new goggle