i need help with my scripts and would like it to start working after my character has fully loaded in to the game and to help me with the timing of two scripts which this script is located in workspace - barrier-script
first script
local barrier = nil
local function initializeBarrier()
barrier = workspace:FindFirstChild("barrier") -- Find the barrier part in the Workspace
if barrier then
wait(41) -- Wait for 30 seconds
while true do
barrier.CanCollide = false -- Enable CanCollide after 30 seconds
barrier.Transparency = 1 -- Set Transparency to 0.6 after 30 seconds
wait(120) -- Wait for an additional 2 minutes (120 seconds)
barrier.Transparency = 0.6 -- Set Transparency to 0 after 2 minutes
barrier.CanCollide = true -- Initially set CanCollide to false
-- Optionally, you can reset the CanCollide property to its original state at this point
-- barrier.CanCollide = <original CanCollide value>
end
else
error("Could not find the 'barrier' part in Workspace.")
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(initializeBarrier)
end)
-- Check if a player is already in the game
for _, player in ipairs(game.Players:GetPlayers()) do
if player.Character then
initializeBarrier()
break
end
end
** You are now Level 3! **