I want to use LocalTransparencyModifier to make beams in my game visible when i go into first person but the scripts im using arent seeming to work for example i have this one in starterplayerscrips
local RunService = game:GetService("RunService")
-- Beam to fix
local beam = workspace:WaitForChild("AirArrows3"):WaitForChild("Beam2")
for _, attachment in ipairs({beam.Attachment0, beam.Attachment1}) do
if attachment and attachment.Parent and attachment.Parent:IsA("BasePart") then
local part = attachment.Parent
-- Force full visibility both ways
part.Transparency = 0
part.LocalTransparencyModifier = 0
-- Keep it that way if the engine tries to override
part.Changed:Connect(function(prop)
if prop == "LocalTransparencyModifier" then
part.LocalTransparencyModifier = 0
elseif prop == "Transparency" then
part.Transparency = 0
end
end)
end
end
You have to run the part.LocalTransparencyModifier = 0 line constantly in a loop. You can use either RenderStepped or Heartbeat from RunService.
local RunService = game:GetService("RunService")
-- Beam to fix
local beam = workspace:WaitForChild("AirArrows3"):WaitForChild("Beam2")
for _, attachment in ipairs({beam.Attachment0, beam.Attachment1}) do
if attachment and attachment.Parent and attachment.Parent:IsA("BasePart") then
local part = attachment.Parent
-- Keep it that way if the engine tries to override
RunService.RenderStepped:Connect(function(deltaTime)
part.LocalTransparencyModifier = 0
part.Transparency = 0
end)
end
end
i added a heartbeat to the code as well and tried to do it this way but it still doesnt work.
local RunService = game:GetService("RunService")
local beam = workspace:WaitForChild("AirArrows3"):WaitForChild("Beam2")
local partsToFix = {}
for _, attachment in ipairs({beam.Attachment0, beam.Attachment1}) do
if attachment and attachment.Parent and attachment.Parent:IsA("BasePart") then
table.insert(partsToFix, attachment.Parent)
end
end
RunService.Heartbeat:Connect(function()
for _, part in ipairs(partsToFix) do
part.Transparency = 0
part.LocalTransparencyModifier = 0
end
end)
Oh, wait… you’re applying a transparency to a beam. I see now…
Okay, so… To fix this, don’t but the beam inside the character. Put it outside the character since roblox makes whatever is inside your character transparent.
And about the code, I don’t think you need it anymore?
how would i go about connecting the beam from the player to destination if i cant put it inside the character?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ActivateBeamEvent2 = ReplicatedStorage:WaitForChild("ActivateBeamEvent2")
local BeamDestroyEvent = ReplicatedStorage:WaitForChild("BeamDestroyEvent")
-- Reference to the arrow model
local arrowModel = game.Workspace:WaitForChild("AirArrows3").Beam2
-- Function to create the arrow beam
local function createArrowBeam2()
local player = game.Players.LocalPlayer
-- Clone the arrow model
local arrowClone = arrowModel:Clone()
-- Set the arrow's position and parent it to the player's PlayerGui
arrowClone.Parent = player.Character
-- Set Attachment0 to player's front attachment
arrowClone.Attachment1 = player.Character.UpperTorso.BodyFrontAttachment
-- Set Attachment1 to the destination attachment
arrowClone.Attachment0 = game.Workspace.AirArrows3.Attachment2
return arrowClone
end
-- Variable to store the arrow beam
local arrowBeam2
-- Event listener for activating the beam
ActivateBeamEvent2.OnClientEvent:Connect(function(destinationAttachment)
-- Create the arrow beam when the event is triggered
arrowBeam2 = createArrowBeam2(destinationAttachment)
end)
-- Event listener for destroying the beam
BeamDestroyEvent.OnClientEvent:Connect(function()
if arrowBeam2 then
arrowBeam2:Destroy()
end
end)
this script handles connecting the beam from the player to the end part
You can set the arrowClone’s parent to be inside the game.Workspace.AirArrows3.Attachment2 make sure that Attachment1 or Attachment0 is located where the player is. In this case you’re using the BodyFrontAttachment inside the player character’s UpperTorso part which is good enough.