make a script in lua roblox where if you press the proximity prompt in the button called…
- User
make a script in lua roblox where if you press the proximity prompt in the button called : GenButton ,every part in the folder called SiteLighting dissapears ,but if you press it again they reappear
Assistant
Here's a Lua script for Roblox that toggles the visibility of parts in the "SiteLighting" folder when a proximity prompt named "GenButton" is pressed:
local button = script.Parent -- Assuming this script is inside the button local proximityPrompt = button:FindFirstChild("GenButton") local siteLighting = game.Workspace:FindFirstChild("SiteLighting") local isLightingOn = true local function toggleLighting() isLightingOn = not isLightingOn for _, part in pairs(siteLighting:GetChildren()) do if part:IsA("BasePart") then part.Transparency = isLightingOn and 0 or 1 part.CanCollide = isLightingOn end end end proximityPrompt.Triggered:Connect(toggleLighting)Would you like me to explain or break down this code?
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.