It would be a script, you can put it in ServerScriptService
, and do you mean, allow the script to reference multiple parts or put the script in multiple parts?
btw sorry for answering late i was at gym
reference multiple parts and if so ill put you on the solution
You can change directory
to their individual locations
example:
local part0 = workspace.Part
local part1 = workspace.Part.Object
and what would be the script for multiple parts if thats easier.
it’s basically copy+pasting the script into different parts, i don’t recommend it tho because if you update one script, you would have to update all of them
would it work if its inside a model?
yea, just make sure that you give the correct locations for them
alright like this?
no, those are strings, not objects. wait, send a picture of your workspace
or this
Workspace like this lol
kk
which model or model(s) contains the buttons and receivers
ok, referencing the button and receivers should look like
local button = workspace.hallways["breach system"].buttonbreach
local reciever = workspace.hallways["breach system"].neonbreach
although, the code has to be edited a bit because there’s mutliple neonbreach
objects
local reciever = workspace.hallways["breach system"]:GetChildren()
local button = workspace.hallways["breach system"].buttonbreach
local cd = button:FindFirstChildOfClass("ClickDetector") or Instance.new("ClickDetector") -- find a click detector, if it can't find one, it will make one
if not cd.Parent then cd.Parent = button end -- if the script created a clickdetector then it will set it's parent to the button
local recieverIsEnabled = false -- default value for the reciever
local neon = Enum.Material.Neon -- the neon material
local smoothPlastic = Enum.Material.SmoothPlastic -- the smoothplastic material
cd.MouseClick:Connect(function(player)
if not recieverIsEnabled then -- if the reciever is disabled
recieverIsEnabled = true -- set the value of "recieverIsEnabled to true"
for _, v in pairs(reciever) do -- loop through the reciever table
if v.Name == "neonbreach" and v:IsA("BasePart") then -- if the object's name and class is "neonbreach" and "BasePart" then continue
v.Material = neon -- set the material to neon
end
end
else
recieverIsEnabled = false
for _, v in pairs(reciever) do
if v.Name == "neonbreach" and v:IsA("BasePart") then
v.Material = smoothPlastic
end
end
end
end)
okay your a god it worked thank you so muchhhh