null
nil
-
0
0
0
1
0
0
0
1
0
0
0
1
UNGROUP ME IN LIGHTING
[null]
-
false
AndGateScript
--
sp=script.Parent
local inputs={sp.Input1:GetCurrentValue(),sp.Input2:GetCurrentValue()}
function check()
if inputs[1]>.5 and sp.Parent:FindFirstChild("Light1Color") then
sp.Parent.Light1Color.BrickColor=BrickColor.new("Dark green")
else
sp.Parent.Light1Color.BrickColor=BrickColor.new("Bright red")
end
if inputs[2]>.5 and sp.Parent:FindFirstChild("Light2Color") then
sp.Parent.Light2Color.BrickColor=BrickColor.new("Dark green")
else
sp.Parent.Light2Color.BrickColor=BrickColor.new("Bright red")
end
if inputs[1]>.5 and inputs[2]>.5 then
sp.Output:SetValue(1)
if sp.Parent:FindFirstChild("Light3Color") then
sp.Parent.Light3Color.BrickColor=BrickColor.new("Dark green")
end
else
sp.Output:SetValue(0)
if sp.Parent:FindFirstChild("Light3Color") then
sp.Parent.Light3Color.BrickColor=BrickColor.new("Bright red")
end
end
end
sp.Input1.SourceValueChanged:connect(function(val)
inputs[1]=val
check()
end)
sp.Input2.SourceValueChanged:connect(function(val)
inputs[2]=val
check()
end)
check()
-
false
Boombox Controller
--
sp=script.Parent
function waitForChild(instance, name)
while not instance:findFirstChild(name) do
instance.ChildAdded:wait()
end
end
local jazzAsset = "http://www.roblox.com/asset/?id=60047782"
local electronicAsset = "http://www.roblox.com/asset/?id=60049010"
local rockAsset = "http://www.roblox.com/asset/?id=60059129"
local funkAsset = "http://www.roblox.com/asset/?id=60051616"
game:GetService("ContentProvider"):Preload(jazzAsset)
game:GetService("ContentProvider"):Preload(electronicAsset)
game:GetService("ContentProvider"):Preload(rockAsset)
game:GetService("ContentProvider"):Preload(funkAsset)
waitForChild(sp, "Sound")
local sound = sp.Sound
waitForChild(sp,"Configuration")
local config = sp:FindFirstChild("Configuration")
waitForChild(sp,"PausePlay")
config.Music.Changed:connect(function()
sound.Volume=0
sound:Stop()
if config.Music.Value == "Rock" then
sound.SoundId = rockAsset
elseif config.Music.Value == "Electronic" then
sound.SoundId = electronicAsset
elseif config.Music.Value == "Jazz" then
sound.SoundId = jazzAsset
elseif config.Music.Value == "Funk" then
sound.SoundId = funkAsset
end
if sp.PausePlay:GetCurrentValue()>=.5 then
sound.Volume=config.Volume.Value
sound:Play()
end
end)
config.Volume.Changed:connect(function()
sound.Volume=config.Volume.Value
end)
sp.PausePlay.SourceValueChanged:connect(function(val)
if val>=.5 then
sound.Volume=config.Volume.Value
sound:Play()
else
sound.Volume=0
sound:Pause()
end
end)
-
false
BoomboxController
--Stickmasterluke
sp=script.Parent
function waitForChild(instance, name)
while not instance:findFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Sound")
local sound=sp.Sound
waitForChild(sp,"Configuration")
local config=sp:FindFirstChild("Configuration")
waitForChild(sp,"PausePlay")
if sp.Configuration:FindFirstChild("Finobe ID") == nil then
local okcloneitok = game.Lighting:FindFirstChild("Finobe ID")
okcloneitok:Clone().Parent = sp.Configuration
end
function update()
sound.Volume=0
sound:Stop()
sound.Pitch=config.Pitch.Value
local idtofinobe = sp.Configuration:FindFirstChild("Finobe ID")
if idtofinobe.Value == false then
sound.SoundId="http://www.roblox.com/asset/?id="..tostring(config.SoundId.Value)
else
sound.SoundId="http://finobe.com/asset?id="..tostring(config.SoundId.Value)
end
if sp.PausePlay:GetCurrentValue()>=.5 then
sound.Volume=config.Volume.Value
sound:Play()
end
end
for i,v in ipairs(config:GetChildren()) do
v.Changed:connect(update)
end
sp.PausePlay.SourceValueChanged:connect(function(val)
if val>=.5 then
sound.Volume=config.Volume.Value
if config.RestartSound.Value then
sound:Stop()
end
sound:Play()
else
sound.Volume=0
sound:Pause()
end
end)
-
false
BoomboxControllera
--Stickmasterluke
sp=script.Parent
function waitForChild(instance, name)
while not instance:findFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Sound")
local sound=sp.Sound
waitForChild(sp,"Configuration")
local config=sp:FindFirstChild("Configuration")
waitForChild(sp,"PausePlay")
function update()
sound.Volume=0
sound:Stop()
sound.Pitch=config.Pitch.Value
--local idtofinobe = sp.Configuration:FindFirstChild("Finobe ID")
sound.SoundId="http://www.roblox.com/asset/?id="..tostring(config.SoundId.Value)
if sp.PausePlay:GetCurrentValue()>=.5 then
sound.Volume=config.Volume.Value
sound:Play()
end
end
for i,v in ipairs(config:GetChildren()) do
v.Changed:connect(update)
end
sp.PausePlay.SourceValueChanged:connect(function(val)
if val>=.5 then
sound.Volume=config.Volume.Value
if config.RestartSound.Value then
sound:Stop()
end
sound:Play()
else
sound.Volume=0
sound:Pause()
end
end)
-
false
ButtonScript
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
function getPlayerFromPart(part)
-- If part is inside a character, then return the player. Else, return nil.
while part do
if part:FindFirstChild("Humanoid") then
return game.Players:GetPlayerFromCharacter(part)
end
part = part.Parent
end
return nil
end
local model = script.Parent
waitForChild(model, "BottomBase")
waitForChild(model, "Knob")
waitForChild(model, "ClickDetector")
waitForChild(model, "Lever")
waitForChild(model, "sidewallRelative")
waitForChild(model.Lever, "LeverEngage")
local lever = model.Lever
local knob = model.Knob
local leverEngage = lever.LeverEngage
local bottomBase = model.BottomBase
local cDetector = model.ClickDetector
local sidewallRelative = model.sidewallRelative
waitForChild(lever, "LeverWeld")
local leverWeld = lever.LeverWeld
--lever.CFrame = sidewallRelative.CFrame + sidewallRelative.CFrame:vectorToWorldSpace(Vector3.new(0.7, 0, 0.7))
local leverOn = false
local leverMoveDiff = 1.7
local movingLever = false
-- was lever last on or off?
if knob.BrickColor.Name ~= "Bright red" then
leverOn = true
end
function moveLever()
leverOn = not leverOn
if leverOn then
knob.BrickColor = BrickColor.new("Bright green")
leverWeld.C1 = leverWeld.C1 + Vector3.new(0, 0, leverMoveDiff)
else
knob.BrickColor = BrickColor.new("Bright red")
leverWeld.C1 = leverWeld.C1 - Vector3.new(0, 0, leverMoveDiff)
end
end
cDetector.MouseClick:connect(function()
if not movingLever then
movingLever = true
if not leverOn then
moveLever() -- bring the lever down
leverEngage:SetValue(1)
else
moveLever() -- bring the lever back up
leverEngage:SetValue(0)
end
movingLever = false
end
end)
-
false
ButtonScriptOK
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
function getPlayerFromPart(part)
-- If part is inside a character, then return the player. Else, return nil.
while part do
if part:FindFirstChild("Humanoid") then
return game.Players:GetPlayerFromCharacter(part)
end
part = part.Parent
end
return nil
end
local model = script.Parent
waitForChild(model, "Base")
waitForChild(model, "BottomBase")
waitForChild(model, "Button")
local button = model.Button
local bottomBase = model.BottomBase
local base = model.Base
-- SETTINGS
--local offColor = BrickColor.new("Deep blue")
--local onColor = BrickColor.new(0.8, 0.8, 0.8)
local onColor = BrickColor.new("Deep orange")
local offColor = BrickColor.new("Neon orange")
local downY = base.Position.Y
local buttonHeight = 0.45 -- Distance above bottomBase that button should be when it's in the up position
local upY = downY + buttonHeight
local threshold = 0.2 -- How far down do you have to press the button before isPressed = true?
local onlyTriggeredByPlayers = true -- Only players can trigger this button.
local button_maxForce = Vector3.new(1200, 1200, 1200) -- MaxForce for the Button's BodyPosition
local button_D = 1250
local button_P = 3500
local stamperToolWasEquipped = false
local isCoolingDown = false
--
local currentColor = 1
local colors = {
BrickColor.new("Camo"),
BrickColor.new("Cyan"),
BrickColor.new("Bright yellow"),
BrickColor.new("Deep blue"),
BrickColor.new("Bright red"),
BrickColor.new("Pink"),
BrickColor.new("Magenta"),
BrickColor.new("Bright red")
}
function button_touchHandler(part)
local playerWhoTouched
playerWhoTouched = getPlayerFromPart(part)
if isCoolingDown then return end
isCoolingDown = true
-- Turn switch on
button.BrickColor = onColor
stop = time() + 1.4
button.ButtonPush:SetValue(1.0)
wait(0.2)
button.ButtonPush:SetValue(0)
button.BrickColor = offColor
wait(0.4)
isCoolingDown = false
end
-- Initialize
button.BrickColor = offColor
-- Connect events
button.Touched:connect(function(part) button_touchHandler(part) end)
-
false
ButtonScriptcoil
--
sp=script.Parent
oncolor=BrickColor.new(28)
offcolor=BrickColor.new("Bright red")
effectparts={"Ring1","Ring2","Ring3","Ring4","Ring5","Ring6"}
function runeffects(trans)
for i,v in ipairs(effectparts) do
local part=sp.Parent:FindFirstChild(v)
if part~=nil then
part.Transparency=trans
end
wait(.15)
end
end
sp.ClickDetector.MouseClick:connect(function()
if sp.BrickColor == oncolor then
sp.BrickColor = offcolor
sp.ButtonPress:SetValue(0)
runeffects(1)
else
sp.BrickColor = oncolor
sp.ButtonPress:SetValue(1)
runeffects(0)
end
end)
-
false
DelayScript
--
sp=script.Parent
function check(val)
if sp.Parent:FindFirstChild("Light1Color") then
if val>.5 then
sp.Parent.Light1Color.BrickColor=BrickColor.new("Dark green")
else
sp.Parent.Light1Color.BrickColor=BrickColor.new("Bright red")
end
end
wait(sp.Configuration.DelayTime.Value)
sp.Output:SetValue(val)
if sp.Parent:FindFirstChild("Light2Color") then
if val>.5 then
sp.Parent.Light2Color.BrickColor=BrickColor.new("Dark green")
else
sp.Parent.Light2Color.BrickColor=BrickColor.new("Bright red")
end
end
end
sp.DelayInput.SourceValueChanged:connect(check)
check(sp.DelayInput:GetCurrentValue())
-
false
DoorScript
-- useless comment here
function waitForChild(parent, child)
while not parent:FindFirstChild(child) do parent.ChildAdded:wait() end
end
local model = script.Parent
local doorOpenTime = 3
local weld1RelativePosition = CFrame.new() + Vector3.new(0, -1.1, .55)
local weld2RelativePosition = CFrame.new() + Vector3.new(0, -1.1, -.55)
waitForChild(model, "PlayerIdTag")
waitForChild(model, "Configuration")
waitForChild(model, "Door1")
waitForChild(model, "Door2")
waitForChild(model, "TouchDoor1")
waitForChild(model, "TouchDoor2")
waitForChild(model, "OuterEdge")
local doorOwnerId = model.PlayerIdTag.Value -- Update the owner ID
local config = model.Configuration
local doorPart1 = model.Door1
local doorPart2 = model.Door2
local doorTouch1 = model.TouchDoor1
local doorTouch2 = model.TouchDoor2
local outerEdge = model.OuterEdge
waitForChild(config, "FriendMode")
local mode = config.FriendMode
function testPermission(part)
doorOwnerId = model.PlayerIdTag.Value -- Update the owner ID
if part == nil then return false end -- In case part was deleted
pChar = part.Parent
if pChar == nil then return false end
pPlay = game.Players:GetPlayerFromCharacter(pChar) -- In case player left game
if pPlay == nil then return false end
-- Test permissions
if(mode.Value == "Everyone") then
return true
elseif (mode.Value == "Only Me") then
if pPlay.userId == doorOwnerId then
return true
else
-- no access
end
elseif(mode.Value == "Friends") then
if (pPlay:IsFriendsWith(doorOwnerId)) then
return true
else
-- no access
end
elseif(mode.Value == "Best Friends") then
if (pPlay:IsBestFriendsWith(doorOwnerId)) then
return true
else
-- no access
end
elseif(mode.Value == "Group") then
if (pPlay:IsInGroup(doorOwnerId)) then
return true
else
-- no access
end
end
return false
end
local isOpen
function doorOpen()
isOpen = true
--if doorPart1:FindFirstChild("DoorWeld") ~= nil then doorPart1.DoorWeld:Remove() end
--if doorPart2:FindFirstChild("DoorWeld") ~= nil then doorPart2.DoorWeld:Remove() end
weld1 = doorPart1:FindFirstChild("DoorWeld")
weld2 = doorPart2:FindFirstChild("DoorWeld")
if not weld1 or not weld2 then return end
-- horrible animation code
for i = 1, 10 do
weld1.C1 = weld1RelativePosition + Vector3.new(0, 0, i * .2)
weld2.C1 = weld2RelativePosition + Vector3.new(0, 0, i * -.2)
wait(.1)
end
end
function doorClose()
-- horrible animation code
weld1 = doorPart1:FindFirstChild("DoorWeld")
weld2 = doorPart2:FindFirstChild("DoorWeld")
if not weld1 or not weld2 then return end
for i = 9, 0, -1 do
weld1.C1 = weld1RelativePosition + Vector3.new(0, 0, i * .2)
weld2.C1 = weld2RelativePosition + Vector3.new(0, 0, i * -.2)
wait(.1)
end
isOpen = false
--doorPart2.CFrame = doorGyro.cframe -- snap shut through the player, so that it doesn't send them flying
end
local debounce = false
local stayOpenTime = 0
function touchEvent(part)
if not part or not part.Parent or part.Parent == model then return end
--if (part ~= door1 and part ~= door2) then
if (testPermission(part)) then
if not debounce and not isOpen then
debounce = true
doorOpen()
wait(doorOpenTime)
while stayOpenTime > 0 do
local tempVariable = stayOpenTime -- allows us to use this variable in the wait while also setting it to zero
stayOpenTime = 0
wait(tempVariable)
end
doorClose()
debounce = false
else
stayOpenTime = doorOpenTime
end
end
--end
end
function changedEvent(prop)
-- Only interested in CFrame (position + rotation) changes
if(prop ~= "CFrame") then return end
--targetPos = underDoors.Position
--door1bp.position = side2.Position
--door2bp.position = side1.Position
--a = underDoors.CFrame.lookVector
--lookVector = Vector3.new( math.abs(a.x), math.abs(a.y), math.abs(a.z) )
--setDoorForces()
end
changedEvent("CFrame") -- Fire once to initialize
-- shut the front door
-- create door welds if we don't have them yet
weld1 = doorPart1:FindFirstChild("DoorWeld")
weld2 = doorPart2:FindFirstChild("DoorWeld")
if not weld1 or not weld2 then
if weld1 then weld1:Remove() end
if weld2 then weld2:Remove() end
newDoorWeld = Instance.new("ManualWeld")
newDoorWeld.Part0 = doorPart1
newDoorWeld.Part1 = outerEdge
newDoorWeld.C1 = weld1RelativePosition
newDoorWeld.Name = "DoorWeld"
newDoorWeld.Parent = doorPart1
newDoorWeld = Instance.new("ManualWeld")
newDoorWeld.Part0 = doorPart2
newDoorWeld.Part1 = outerEdge
newDoorWeld.C1 = weld2RelativePosition
newDoorWeld.Name = "DoorWeld"
newDoorWeld.Parent = doorPart2
else
weld1.C1 = weld1RelativePosition
weld2.C1 = weld2RelativePosition
end
isOpen = false
doorTouch1.Touched:connect(touchEvent)
doorTouch2.Touched:connect(touchEvent)
print("REACHED END")
-
false
DoorScriptDraw
--Stickmasterluke
sp=script.Parent
framerate=30
frames=1
running=false
direction=1
function waitForChild(instance,name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Bottom")
waitForChild(sp.Bottom,"CloseGate")
waitForChild(sp.Bottom,"Configuration")
function checkframes()
if sp:FindFirstChild("Bottom") then
local config=sp.Bottom:FindFirstChild("Configuration")
if config then
frames=math.floor(config.TimeToMove.Value*framerate)+1
end
end
end
sp.Bottom.Configuration.TimeToMove.Changed:connect(checkframes)
checkframes()
function updatedoor(frame)
local percentage=1-(frame/frames)
if sp:FindFirstChild("Bottom") then
local hinge1=sp.Bottom:FindFirstChild("HingeMain")
if hinge1~=nil then
hinge1.C1=CFrame.new(0,-4,0)*CFrame.Angles(math.pi/2*percentage,0,0)
end
local hinge2=sp.Bottom:FindFirstChild("HingeSecondary")
if hinge2~=nil then
hinge2.C1=CFrame.new(0,-10,0)*CFrame.Angles(math.pi/2*percentage,0,0)
end
local hinge3=sp.Bottom:FindFirstChild("HingeCorner1")
if hinge3~=nil then
hinge3.C1=CFrame.new(0,0,10)*CFrame.Angles(0,math.pi/2*-percentage,0)
end
local hinge4=sp.Bottom:FindFirstChild("HingeCorner2")
if hinge4~=nil then
hinge4.C1=CFrame.new(0,0,10)*CFrame.Angles(0,math.pi/2*percentage,math.pi)
end
local hinge5=sp.Bottom:FindFirstChild("HingeCorner3")
if hinge5~=nil then
hinge5.C1=CFrame.new(0,0,13)*CFrame.Angles(0,math.pi/2*-percentage,0)
end
local hinge6=sp.Bottom:FindFirstChild("HingeCorner4")
if hinge6~=nil then
hinge6.C1=CFrame.new(0,0,13)*CFrame.Angles(0,math.pi/2*percentage,math.pi)
end
end
end
function runloop()
if not running then
running=true
while true do
if sp:FindFirstChild("Bottom") then
local frame=sp.Bottom:FindFirstChild("Frame")
if frame then
frame.Value=frame.Value+direction
if frame.Value>frames then
frame.Value=frames
end
if frame.Value<=0 then
frame.Value=0
end
updatedoor(frame.Value)
wait(1/framerate)
if frame then
if (frame.Value<=0 and direction==-1) or (frame.Value>=frames and direction==1) then
break
end
end
else
break
end
else
break
end
end
running=false
end
end
function check(val)
if val>.5 then
direction=1
else
direction=-1
end
runloop()
end
sp.Bottom.CloseGate.SourceValueChanged:connect(check)
check(sp.Bottom.CloseGate:GetCurrentValue())
-
false
DoorScriptSci
--Stickmasterluke
sp=script.Parent
framerate=30
frames=1
running=false
direction=1
function waitForChild(instance,name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Bottom")
waitForChild(sp.Bottom,"OpenDoor")
waitForChild(sp.Bottom,"Configuration")
function checkframes()
if sp:FindFirstChild("Bottom") then
local config=sp.Bottom:FindFirstChild("Configuration")
if config then
frames=math.floor(config.TimeToMove.Value*framerate)+1
end
end
end
sp.Bottom.Configuration.TimeToMove.Changed:connect(checkframes)
checkframes()
function updatedoor(frame)
local percentage=frame/frames
if sp:FindFirstChild("Bottom") then
local bottomhinge=sp.Bottom:FindFirstChild("BottomHinge")
if bottomhinge~=nil then
bottomhinge.C1=CFrame.new(0,3.25*percentage,0)
end
local tophinge=sp.Bottom:FindFirstChild("TopHinge")
if tophinge~=nil then
tophinge.C1=CFrame.new(0,-3.25*percentage,0)
end
local center1=sp.Bottom:FindFirstChild("Center1Hinge")
if center1~=nil then
center1.C1=CFrame.new(0,0,3.25*percentage)
end
local center2=sp.Bottom:FindFirstChild("Center2Hinge")
if center2~=nil then
center2.C1=CFrame.new(0,0,3.25*percentage)
end
end
end
function checkemitters()
if sp:FindFirstChild("Emitter1") then
sp.Emitter1.Smoke.Enabled=running
end
if sp:FindFirstChild("Emitter2") then
sp.Emitter2.Smoke.Enabled=running
end
end
checkemitters()
function runloop()
if not running then
running=true
checkemitters()
while true do
if sp:FindFirstChild("Bottom") then
local frame=sp.Bottom:FindFirstChild("Frame")
if frame then
frame.Value=frame.Value+direction
if frame.Value>frames then
frame.Value=frames
end
if frame.Value<=0 then
frame.Value=0
end
updatedoor(frame.Value)
wait(1/framerate)
if frame then
if (frame.Value<=0 and direction==-1) or (frame.Value>=frames and direction==1) then
break
end
end
else
break
end
else
break
end
end
running=false
checkemitters()
end
end
function check(val)
if val>.5 then
direction=1
else
direction=-1
end
runloop()
end
sp.Bottom.OpenDoor.SourceValueChanged:connect(check)
check(sp.Bottom.OpenDoor:GetCurrentValue())
-
false
DoorScriptWIRING
--Stickmasterluke
sp=script.Parent
framerate=30
frames=1
running=false
direction=1
function waitForChild(instance,name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Bottom")
waitForChild(sp.Bottom,"OpenDoor")
waitForChild(sp.Bottom,"Configuration")
function checkframes()
if sp:FindFirstChild("Bottom") then
local config=sp.Bottom:FindFirstChild("Configuration")
if config then
frames=math.floor(config.TimeToMove.Value*framerate)+1
end
end
end
sp.Bottom.Configuration.TimeToMove.Changed:connect(checkframes)
checkframes()
function updatedoor(frame)
local percentage=frame/frames
if sp:FindFirstChild("Bottom") then
local hinge1=sp.Bottom:FindFirstChild("Hinge1")
if hinge1~=nil then
hinge1.C1=CFrame.new(1.75,0,0)*CFrame.Angles(0,(math.pi/2)*percentage,0)*CFrame.new(-1.75,0,0)
end
local hinge2=sp.Bottom:FindFirstChild("Hinge2")
if hinge2~=nil then
hinge2.C1=CFrame.new(-1.75,0,0)*CFrame.Angles(0,(-math.pi/2)*percentage,0)*CFrame.new(1.75,0,0)
end
end
end
function runloop()
if not running then
running=true
while true do
if sp:FindFirstChild("Bottom") then
local frame=sp.Bottom:FindFirstChild("Frame")
if frame then
frame.Value=frame.Value+direction
if frame.Value>frames then
frame.Value=frames
end
if frame.Value<=0 then
frame.Value=0
end
updatedoor(frame.Value)
wait(1/framerate)
if frame then
if (frame.Value<=0 and direction==-1) or (frame.Value>=frames and direction==1) then
break
end
end
else
break
end
else
break
end
end
running=false
end
end
function check(val)
if val>.5 then
direction=1
else
direction=-1
end
runloop()
end
sp.Bottom.OpenDoor.SourceValueChanged:connect(check)
check(sp.Bottom.OpenDoor:GetCurrentValue())
-
false
DoorScriptiris
--Stickmasterluke
sp=script.Parent
framerate=30
frames=1
running=false
direction=1
function waitForChild(instance,name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Bottom")
waitForChild(sp.Bottom,"OpenDoor")
waitForChild(sp.Bottom,"Configuration")
function checkframes()
if sp:FindFirstChild("Bottom") then
local config=sp.Bottom:FindFirstChild("Configuration")
if config then
frames=math.floor(config.TimeToMove.Value*framerate)+1
end
end
end
sp.Bottom.Configuration.TimeToMove.Changed:connect(checkframes)
checkframes()
function updatedoor(frame)
local percentage=frame/frames
if sp:FindFirstChild("Bottom") then
local hingedist=1.9
local hinge1=sp.Bottom:FindFirstChild("Door1")
if hinge1~=nil then
hinge1.C1=CFrame.new(-hingedist,-hingedist,0)*CFrame.Angles(0,0,(math.pi/2)*percentage)*CFrame.new(hingedist,hingedist,0)
end
local hinge1=sp.Bottom:FindFirstChild("Door2")
if hinge1~=nil then
hinge1.C1=CFrame.new(-hingedist,hingedist,0)*CFrame.Angles(0,0,(math.pi/2)*percentage)*CFrame.new(hingedist,-hingedist,0)
end
local hinge1=sp.Bottom:FindFirstChild("Door3")
if hinge1~=nil then
hinge1.C1=CFrame.new(hingedist,hingedist,0)*CFrame.Angles(0,0,(math.pi/2)*percentage)*CFrame.new(-hingedist,-hingedist,0)
end
local hinge1=sp.Bottom:FindFirstChild("Door4")
if hinge1~=nil then
hinge1.C1=CFrame.new(hingedist,-hingedist,0)*CFrame.Angles(0,0,(math.pi/2)*percentage)*CFrame.new(-hingedist,hingedist,0)
end
end
end
function runloop()
if not running then
running=true
while true do
if sp:FindFirstChild("Bottom") then
local frame=sp.Bottom:FindFirstChild("Frame")
if frame then
frame.Value=frame.Value+direction
if frame.Value>frames then
frame.Value=frames
end
if frame.Value<=0 then
frame.Value=0
end
updatedoor(frame.Value)
wait(1/framerate)
if frame then
if (frame.Value<=0 and direction==-1) or (frame.Value>=frames and direction==1) then
break
end
end
else
break
end
else
break
end
end
running=false
end
end
function check(val)
if val>.5 then
direction=1
else
direction=-1
end
runloop()
end
sp.Bottom.OpenDoor.SourceValueChanged:connect(check)
check(sp.Bottom.OpenDoor:GetCurrentValue())
-
false
DoorbellScript
--Stickmasterluke
sp=script.Parent
button=sp.Parent:FindFirstChild("Button")
ontill=0
function on()
sp.ButtonPushed:SetValue(1)
button.BrickColor=BrickColor.new("Cool yellow")
button.Mesh.Offset=Vector3.new(0,.25,0)
end
function off()
sp.ButtonPushed:SetValue(0)
button.BrickColor=BrickColor.new("Bright yellow")
button.Mesh.Offset=Vector3.new(0,.1,0)
end
button.ClickDetector.MouseClick:connect(function()
on()
ontill=tick()+sp.Configuration.ActivationTime.Value
while ontill>tick() do
wait()
end
off()
end)
-
false
ElevatorScript
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
-- SETTINGS
local offColor = BrickColor.new("Earth green")
local onColor = BrickColor.new("Lime green")
local platformOffset = -3.6 -- Offset the platform this many studs from the goalTop and goalBottom positions (along the Platform's lookVector axis).
local triggerStopThreshold = 1 -- How close must platform be to goal position to signal a stop?
local model = script.Parent
waitForChild(model, "SwitchBottom")
waitForChild(model, "SwitchBottomWedge")
waitForChild(model, "SwitchTop")
waitForChild(model, "Platform")
waitForChild(model, "Invisiweight")
waitForChild(model, "Spine")
waitForChild(model, "Bottom")
waitForChild(model, "SpineBottom")
local platform = model.Platform
local weight = model.Invisiweight
waitForChild(weight, "BodyPosition")
local bodyPosition = weight.BodyPosition
waitForChild(weight, "BodyGyro")
local bodyGyro = weight.BodyGyro
local switchBottom = model.SwitchBottom
local switchBottomWedge = model.SwitchBottomWedge
local switchTop = model.SwitchTop
local spine = model.Spine
local spineBottom = model.SpineBottom
local bottom = model.Bottom
local goalTop = switchTop
local goalBottom = spineBottom
local goalTopPosition -- Platform's position at top
local goalBottomPosition -- Platform's position at bottom
local goalPositionOffset = Vector3.new(0, (weight.Size.y/2 + platform.Size.y/2), 0)
-- In more exact terms: goalTop.Position + Platform.CFrame.lookVector*(this amount) should put the platform in its goalTop and goalBottom positions.
local isMoving = false
local isGoingUp = false
local timeout = 5
local platformListenerDisabled = false -- Necessary because your legs call the platform way too much.
-- FUNCTIONS
function platformLoop()
local endTime = time() + timeout
local stayAlive = true
while stayAlive do
local dist = weight.Position - bodyPosition.position
if(dist.magnitude <= triggerStopThreshold) then
print("Platform has reached goal. isMoving = false.")
isMoving = false
stayAlive = false
else
wait(0.5)
print("loop...")
if time() > endTime then
print("loop: timeout. Reversing...")
if isGoingUp then
moveElevatorDown()
else
moveElevatorUp()
end
stayAlive = false
end
end
end
end
platformCoroutine = coroutine.create(platformLoop)
function moveElevatorUp()
print("moveElevatorUp()")
switchTop.BrickColor = onColor
switchBottom.BrickColor = offColor
switchBottomWedge.BrickColor = offColor
bodyPosition.position = goalTopPosition
bodyGyro.cframe = CFrame.new(goalTopPosition, goalTopPosition + spine.CFrame.lookVector)
isMoving = true
local status = coroutine.status(platformCoroutine)
print(status)
if status=="dead" then
platformCoroutine = coroutine.create(platformLoop)
coroutine.resume(platformCoroutine)
end
end
function moveElevatorDown()
print("moveElevatorDown()")
switchTop.BrickColor = offColor
switchBottom.BrickColor = onColor
switchBottomWedge.BrickColor = onColor
bodyPosition.position = goalBottomPosition
bodyGyro.cframe = CFrame.new(goalTopPosition, goalTopPosition + spine.CFrame.lookVector)
isMoving = true
local status = coroutine.status(platformCoroutine)
print(status)
if status=="dead" then
platformCoroutine = coroutine.create(platformLoop)
coroutine.resume(platformCoroutine)
end
end
function switchTopListener(part)
print("switchTopListener():", part)
if part==nil then print("switchTopListener(): part==nil. Canceling.") return end
if part.Parent==model then print("switchTopListener(): part.Parent==elevator. Canceling.") return end
moveElevatorUp()
end
function switchBottomListener(part)
print("switchBottomListener():", part)
if part==nil then print("switchBottomListener(): part==nil. Canceling.") return end
if part.Parent==model then print("switchBottomListener(): part.Parent==elevator. Canceling.") return end
moveElevatorDown()
end
function platformListener(part)
-- when you walk onto the platform, and it's stopped at either top or bottom, trigger it after a short delay.
if part==nil then print("platformListener(): part==nil. Canceling.") return end
if part.Parent==model then print("platformListener(): part.Parent==nil. Canceling.") return end
if isMoving then print("platformListener(): isMoving==true. Canceling.") return end
if platformListenerDisabled then print ("platformListener(): platformListenerDisabled==true. Canceling.") return end
print("platformListener():", part)
platformListenerDisabled = true
wait(1.5)
if(bodyPosition.position==goalBottomPosition) then
moveElevatorUp()
elseif(bodyPosition.position==goalTopPosition) then
moveElevatorDown()
else
print("Platform is somewhere in middle, and not moving. What the heck?")
end
platformListenerDisabled = false
end
function getWeight(part)
-- Returns the force of gravity on the object
-- Useful for making things weightless
-- If part is inside a character, we get weight of the entire character.
-- Otherwise, we get weight of only this part.
local character
while part.Parent ~= nil and part.Parent ~= Workspace do
if part:FindFirstChild("Humanoid") then
character = part
end
end
local parts
if character then
-- It's a character. Find mass of character.
parts = character:GetChildren()
else
parts = {part}
end
-- Sum up the mass of all parts
local mass = 0
for i=1,#parts do
local n = parts[i].className
if(n=="Part" or n=="TrussPart" or n=="WedgePart") then
mass = mass + parts[i]:GetMass()
elseif(n=="Hat" or n=="Tool") then
mass = mass + parts[i].Handle:GetMass()
end
end
print("getWeight(): character:", character, "part:", part, "mass:", mass)
end
function setGoalPositions()
local wasAlignedTo
if bodyPosition.position == goalTopPosition then wasAlignedTo = "top"
elseif bodyPosition.position == goalBottomPosition then wasAlignedTo = "bottom" end
--goalTopPosition = goalTop.Position + platformOffset*platform.CFrame.lookVector + goalPositionOffset
--goalBottomPosition = goalBottom.Position + platformOffset*platform.CFrame.lookVector + goalPositionOffset
goalTopPosition = goalTop.Position + goalPositionOffset + platformOffset * spine.CFrame.lookVector
goalBottomPosition = goalBottom.Position + goalPositionOffset + platformOffset * spine.CFrame.lookVector
if wasAlignedTo=="top" then bodyPosition.position = goalTopPosition bodyGyro.cframe = CFrame.new(goalTopPosition, goalTopPosition + spine.CFrame.lookVector)
elseif wasAlignedTo=="bottom" then bodyPosition.position = goalBottomPosition bodyGyro.cframe = CFrame.new(goalTopPosition, goalTopPosition + spine.CFrame.lookVector) end
print("setGoalPositions() top:", goalTopPosition, "bottom:", goalBottomPosition)
end
function changedEvent(prop)
-- Only interested in CFrame (position + rotation) changes
if(prop ~= "CFrame") then return end
print("changedEvent()", prop)
setGoalPositions()
end
function destroyElevator()
-- Destroy forces, and disable script.
print("destroyElevator()")
a = weight:GetChildren()
for i=1,#a do
a[i]:Remove()
end
-- Make switches dark
switchTop.BrickColor = offColor
switchBottom.BrickColor = offColor
switchBottomWedge.BrickColor = offColor
-- Disconnect events
pcall(function() con1:disconnect() end)
pcall(function() con2:disconnect() end)
pcall(function() con3:disconnect() end)
pcall(function() con4:disconnect() end)
pcall(function() con5:disconnect() end)
pcall(function() con6:disconnect() end)
script.Disabled = true
end
function checkIfHasWeld(part)
print("checkIfHasWeld():", part)
-- If spine and bottom have no weld, then the elevator has come unanchored and must break. (Otherwise, platform will float mid-air.)
local hasAWeld = false
local a = bottom:GetChildren()
for i=1,#a do
local c = a[i].className
if c=="Weld" or c=="ManualWeld" then hasAWeld = true end
end
local a = spine:GetChildren()
for i=1,#a do
local c = a[i].className
if c=="Weld" or c=="ManualWeld" then hasAWeld = true end
end
if not hasAWeld then destroyElevator() return end
end
setGoalPositions() -- Fire once to initialize
if (weight.Position - goalTopPosition):Dot(weight.Position - goalTopPosition) < (weight.Position - goalBottomPosition):Dot(weight.Position - goalBottomPosition) then
isGoingUp = true
moveElevatorUp()
else
moveElevatorDown()
end
bodyPosition.maxForce = Vector3.new(200000, 16000, 200000)
bodyGyro.maxTorque = Vector3.new(4000000, 4000000, 4000000)
wait(1)
print("ElevatorScript: adding connections.")
local con1 = switchBottom.Touched:connect(switchBottomListener)
local con2 = switchTop.Touched:connect(switchTopListener)
local con3 = platform.Touched:connect(platformListener)
local con4 = spine.Changed:connect(changedEvent)
local con5 = spine.ChildRemoved:connect(checkIfHasWeld)
local con6 = bottom.ChildRemoved:connect(checkIfHasWeld)
print("ElevatorScript: finished adding connections.")
coroutine.resume(platformCoroutine)
-
false
EnergyScript
script.Parent.ConstantCurrent:SetValue(1)
-- ...good?
-
Finobe ID
false
-
false
FixThings
while true do
wait (.5)
for _,v in pairs(script.Parent:GetChildren()) do
if v.Name == "Spikes_Simple" then
for _,q in pairs(v:GetChildren()) do
game.Lighting.SpikeScript:Clone().Parent = q
end
end
if v.Name == "Spike_Retracting" and v:FindFirstChild("SpikeTrap") == nil then
game.Lighting.SpikeControlScript:Clone().Parent = v.Spikes
end
if v.Name == "FriendOnlyDoorHostile" then
game.Lighting.FriendDoorDeadly:Clone().Parent = v
v.FriendDoorDeadly.Name = "Script"
v.Script.Disabled = false
end
if v.Name == "SpaceHatch" then
game.Lighting.DoorScript:Clone().Parent = v
end
if v.Name == "UltimateFloatPadSideways" then
game.Lighting.PadScript:Clone().Parent = v
end
if v.Name == "UltimateFloatPad" then
game.Lighting.PadScript:Clone().Parent = v
end
if v.Name == "e" then
game.Lighting.ElevatorScript:Clone().Parent = v
end
if v.Name == "FriendOnlyDoor2" then
game.Lighting.ScriptFO:Clone().Parent = v
end
if v.Name == "Boombox" then
local controller = game.Lighting:FindFirstChild("Boombox Controller")
controller:Clone().Parent = v.Boombox
end
if v.Name == "WireLeverSimple" then
game.Lighting.ButtonScript:Clone().Parent = v
end
if v.Name == "ConfigPortrait" then
game.Lighting.PictureScript:Clone().Parent = v.Picture
end
if v.Name == "ConfigPlacePicture" then
game.Lighting.PictureScripts:Clone().Parent = v.Picture
end
if v.Name == "IrisDoor" then
game.Lighting.DoorScriptiris:Clone().Parent = v
end
if v.Name == "LaserTrigger" then
game.Lighting.LaserTriggerScript:Clone().Parent = v
end
if v.Name == "LightSwitch" then
game.Lighting.SwitchScript:Clone().Parent = v.Fixture
end
if v.Name == "SciFiDoor" then
game.Lighting.DoorScriptSci:Clone().Parent = v
end
----[[
if v.Name == "WiredTrapPart" then
game.Lighting.PlatformScrwipt:Clone().Parent = v.Head
end
--]]--
if v.Name == "Timer" then
game.Lighting.TimerScript:Clone().Parent = v
end
if v.Name == "DoorbellButton" then
game.Lighting.DoorbellScript:Clone().Parent = v.Fixture
end
if v.Name == "CastleDrawbridge" then
game.Lighting.DoorScriptDraw:Clone().Parent = v
end
if v.Name == "EnergyButton" then
game.Lighting.ButtonScriptcoil:Clone().Parent = v.Button
end
if v.Name == "Speaker" then
if script.DoesFinobe.Value == true then
game.Lighting.BoomboxController:Clone().Parent = v.Speaker
else
game.Lighting.BoomboxControllera:Clone().Parent = v.Speaker
end
-- local okcloneitok = game.Lighting:FindFirstChild("Finobe ID")
-- okcloneitok:Clone().Parent = v.Configuration
end
if v.Name == "Incinerator" then
game.Lighting.Grate:Clone().Parent = v.Grate
end
if v.Name == "MagicBall" then
game.Lighting.MagicScript:Clone().Parent = v:FindFirstChild("Control Sphere")
end
if v.Name == "EnergyCore" then
game.Lighting.EnergyScript:Clone().Parent = v.EnergyBall
end
if v.Name == "DelayGate" then
game.Lighting.DelayScript:Clone().Parent = v.BasePart
end
if v.Name == "Repeater" then
game.Lighting.RepeaterScript:Clone().Parent = v.BasePart
end
if v.Name == "Inverter" then
game.Lighting.InvertScript:Clone().Parent = v.BasePart
end
if v.Name == "ORgate" then
game.Lighting.OrGateScript:Clone().Parent = v.BasePart
end
if v.Name == "ANDgate" then
game.Lighting.AndGateScript:Clone().Parent = v.BasePart
end
if v.Name == "Lamp" then
game.Lighting.LightScript:Clone().Parent = v.Light
end
if v.Name == "WiredButton1" then
game.Lighting.ButtonScriptOK:Clone().Parent = v.Button
end
----[[
if v.Name == "Flame Thrower" then
game.Lighting.ScriptFT:Clone().Parent = v.Flamethrower
end
-- ]]--
if v.Name == "TransparentTrigger" then
game.Lighting.ScriptSSS:Clone().Parent = v.Part
end
if v.Name == "AppearingPlatformModel" then
game.Lighting.PlatformScript:Clone().Parent = v.AppearingPlatform
end
if v.Name == "WiringDoor" then
game.Lighting.DoorScriptWIRING:Clone().Parent = v
end
if v.Name == "Trapdoor" then
game.Lighting.Trapscript:Clone().Parent = v.Head
end
if v.Name == "Head" then
game.Lighting.Trapscript:Clone().Parent = v
end
if v.Name ~= "FixThings" then
v.Parent = game.Workspace
end
end
end
-
DoesFinobe
false
-
true
FriendDoorDeadly
-- useless comment
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
local debris = game:GetService("Debris")
print("Starting script")
local door = script.Parent
waitForChild(door, "PlayerIdTag")
print("Getting ownerId")
local ownerId = door.PlayerIdTag.Value
waitForChild(door, "Poster")
local poster = door.Poster.Decal
poster.Texture = ("http://finobe.com/thumbnail/user/" .. tostring(ownerId))
print("Getting Lasers")
waitForChild(door, "Laser1")
waitForChild(door, "Laser2")
waitForChild(door, "Laser3")
waitForChild(door, "Bottom")
local laser1 = door.Laser1
local laser2 = door.Laser2
local laser3 = door.Laser3
local laserWeld1 = door:FindFirstChild("LaserWeld1")
if not laserWeld1 then
laserWeld1 = Instance.new("ManualWeld")
laserWeld1.Name = "LaserWeld1"
laserWeld1.Part0 = laser1
laserWeld1.Part1 = door.Bottom
laserWeld1.C0 = laser1.CFrame:inverse() * door.Bottom.CFrame
laserWeld1.Parent = door
laser1.Anchored = false
else
laserWeld1.C0 = laser1.CFrame:inverse() * door.Bottom.CFrame
end
local laserWeld2 = door:FindFirstChild("LaserWeld2")
if not laserWeld2 then
laserWeld2 = Instance.new("ManualWeld")
laserWeld2.Name = "LaserWeld2"
laserWeld2.Part0 = laser2
laserWeld2.Part1 = door.Bottom
laserWeld2.C0 = laser2.CFrame:inverse() * door.Bottom.CFrame
laserWeld2.Parent = door
laser2.Anchored = false
else
laserWeld2.C0 = laser2.CFrame:inverse() * door.Bottom.CFrame
end
local laserWeld3 = door:FindFirstChild("LaserWeld3")
if not laserWeld3 then
laserWeld3 = Instance.new("ManualWeld")
laserWeld3.Name = "LaserWeld3"
laserWeld3.Part0 = laser3
laserWeld3.Part1 = door.Bottom
laserWeld3.C0 = laser3.CFrame:inverse() * door.Bottom.CFrame
laserWeld3.Parent = door
laser3.Anchored = false
else
laserWeld3.C0 = laser3.CFrame:inverse() * door.Bottom.CFrame
end
local lasers = {laser1, laser2, laser3}
local laserWelds = {laserWeld1, laserWeld2, laserWeld3}
print("Defining fcns")
local laserTextures = {}
for i = 1, #lasers do
laserTextures[2*i-1] = lasers[i].Decal1.Texture
laserTextures[2*i] = lasers[i].Decal2.Texture
end
waitForChild(door, "Wedge1")
waitForChild(door, "Wedge2")
local Wedge1 = door.Wedge1
local Wedge2 = door.Wedge2
local wedge1 = Wedge1.Position
local wedge2 = Wedge2.Position
function burninatePlayer(vChar)
--vChar.Head:remove() -- for now, simple kill
if vChar:FindFirstChild("Torso") then
vChar.Torso:BreakJoints()
littleParts = vChar:GetChildren()
for i = 1, #littleParts do
if littleParts[i]:IsA("Part") or littleParts[i]:IsA("TrussPart") or littleParts[i]:IsA("WedgePart") then
if littleParts[i]:FindFirstChild("Burrrrrn") == nil then
tempFire = Instance.new("Fire")
tempFire.Name = "Burrrrrn"
tempFire.Parent = littleParts[i]
end
end
end
end
end
function shutOffLasers()
lasers[#lasers].CanCollide = false
for i = 1, #lasers do
lasers[i].Decal1.Texture = ""
lasers[i].Decal2.Texture = ""
end
end
function turnOnLasers()
lasers[#lasers].CanCollide = true
for i = 1, #lasers do
lasers[i].Decal1.Texture = laserTextures[2*i-1]
lasers[i].Decal2.Texture = laserTextures[2*i]
end
end
function flickerOnLasers()
for i = 1, #lasers do
coinFlip = math.random(0,1)
if coinFlip == 0 then
lasers[i].Decal1.Texture = laserTextures[2*i-1]
lasers[i].Decal2.Texture = laserTextures[2*i]
end
end
end
function flickerOffLasers()
for i = 1, #lasers do
coinFlip = math.random(0,1)
if coinFlip == 0 then
lasers[i].Decal1.Texture = ""
lasers[i].Decal2.Texture = ""
end
end
end
function accessGranted(part)
-- prevent outside collisions (as extremities can "poke through" walls)
if part.Name == "Right Leg" or part.Name == "Left Leg" or part.Name == "Right Arm" or part.Name == "Left Arm" then return false end
if part == nil then return false end
pChar = part.Parent
if pChar == nil then return false end
pPlay = game.Players:GetPlayerFromCharacter(pChar)
if pPlay == nil then return false end
-- insert friend code here... currently, door will open at a humanoid's touch
if (pPlay:IsFriendsWith(ownerId)) or player.userId == ownerId then return true end
burninatePlayer(pChar)
return false
--return true
end
--local lasersOn = {true, true, true}
local lasersOn = true
function checkHit(part)
if not part or not part.Parent then return end
local didItHit = accessGranted(part)
if lasersOn and didItHit then
-- win
lasersOn = false
shutOffLasers()
wait(5)
flickerOnLasers()
wait(.1)
flickerOffLasers()
wait(.2)
flickerOnLasers()
wait(.1)
flickerOffLasers()
wait(.1)
turnOnLasers()
lasersOn = true
end
end
for i = 1, #lasers do
lasers[i].Touched:connect(checkHit)
end
--[[for i = 1, #lasers do
lasers[i].Touched:connect(function (part)
if lasersOn[i] and not accessGranted(part) then
-- win
lasersOn[i] = false
lasers[i].Decal1.Texture = ""
lasers[i].Decal2.Texture = ""
wait(5)
lasers[i].Decal1.Texture = laserTextures[2*i-1]
lasers[i].Decal2.Texture = laserTextures[2*i]
wait(.1)
lasers[i].Decal1.Texture = ""
lasers[i].Decal2.Texture = ""
wait(.2)
lasers[i].Decal1.Texture = laserTextures[2*i-1]
lasers[i].Decal2.Texture = laserTextures[2*i]
wait(.1)
lasers[i].Decal1.Texture = ""
lasers[i].Decal2.Texture = ""
wait(.1)
lasers[i].Decal1.Texture = laserTextures[2*i-1]
lasers[i].Decal2.Texture = laserTextures[2*i]
lasersOn[i] = true
end
end)
end
--]]
print("fodhv ended")
local laserVelocities = {Vector3.new(0,0,0.5), Vector3.new(0,0,-0.5), Vector3.new(0,0,0)}
local dir = (wedge2 - wedge1).unit
--[[for i = 1, #lasers do
coinFlip = math.random(0,1)
if coinFlip == 0 then
--lasers[i].Velocity = dir / 2
lasers[i].Velocity = Vector3.new(1,0,0)/2
else
--lasers[i].Velocity = -dir / 2
lasers[i].Velocity = -Vector3.new(1,0,0)/2
end
end]]--
local dist = math.sqrt((wedge2 - wedge1):Dot(wedge2 - wedge1))
local loopGo = true
while loopGo do
wedge1 = Wedge1.Position
wedge2 = Wedge2.Position
dir = (wedge2 - wedge1).unit
loopGo = false
for i = 1, #lasers-1 do
if lasers[i] ~= nil and lasers[i].Parent ~= nil then
--if (lasers[i].Position-wedge1):Dot(dir) <= 0 or (lasers[i].Position - wedge1):Dot(dir) > dist then laserVelocities[i] = -laserVelocities[i] end
--lasers[i].CFrame = lasers[i].CFrame + lasers[i].Velocity
if (lasers[i].Position-wedge1-dir*.5):Dot(dir) <= 0 then -- extra -dir*.5 so that it breaks one step early and returns without expanding bounding box
--laserVelocities[i] = -laserVelocities[i]
laserVelocities[i] = Vector3.new(0, 0, 0.5)
elseif (lasers[i].Position - wedge1):Dot(dir) > dist then
--laserVelocities[i] = -laserVelocities[i]
laserVelocities[i] = Vector3.new(0, 0, -0.5)
end
if laserWelds[i] ~= nil and laserWelds[i].Parent ~= nil then laserWelds[i].C0 = laserWelds[i].C0 + laserVelocities[i] loopGo = true
else
-- laser dead; make sure we remove it [commented out for now, since this gets triggered when we rotate the model (since scripts aren't currently stopped correctly)]
--lasers[i].Parent = nil
loopGo = true
end
end
end
wait(.1)
end
-- if we get here, then all three laserWelds have been killed X|
debris:AddItem(door, 15)
-
false
Grate
--
sp=script.Parent
function incinerate(part)
if part and sp.Fire.Enabled then
if part.Parent then
if part.Parent~=sp.Parent and not part.Anchored then
part:BreakJoints()
part.BrickColor=BrickColor.new("Black")
delay(sp.Configuration.IncinerationSpeed.Value,function()
if part then
if part.Parent~=nil then
part:remove()
end
end
end)
end
end
end
end
sp.Touched:connect(incinerate)
function check(val)
if val==1 then
sp.Fire.Enabled=true
initialparts=game.Workspace:FindPartsInRegion3(Region3.new(sp.Position+Vector3.new(-sp.Size.x/2,.4,-sp.Size.z/2),sp.Position+Vector3.new(sp.Size.x/2,3,sp.Size.z/2)),nil,100)
for i,v in ipairs(initialparts) do
incinerate(v)
end
else
sp.Fire.Enabled=false
end
end
sp.Input.SourceValueChanged:connect(check)
check(sp.Input:GetCurrentValue())
-
false
InvertScript
--
sp=script.Parent
function check(val)
if val==0 then
sp.Output:SetValue(1)
if sp.Parent:FindFirstChild("Light1Color") then
sp.Parent.Light1Color.BrickColor=BrickColor.new("Bright red")
end
if sp.Parent:FindFirstChild("Light2Color") then
sp.Parent.Light2Color.BrickColor=BrickColor.new("Dark green")
end
else
sp.Output:SetValue(0)
if sp.Parent:FindFirstChild("Light1Color") then
sp.Parent.Light1Color.BrickColor=BrickColor.new("Dark green")
end
if sp.Parent:FindFirstChild("Light2Color") then
sp.Parent.Light2Color.BrickColor=BrickColor.new("Bright red")
end
end
end
sp.InvertInput.SourceValueChanged:connect(check)
check(sp.InvertInput:GetCurrentValue())
-
false
LaserTriggerScript
--Stickmasterluke
sp=script.Parent
recasttime=.15
maxdist=50
leeway=.1
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Configuration")
waitForChild(sp,"Base")
waitForChild(sp.Base,"LaserTrigger")
waitForChild(sp,"Laser")
waitForChild(sp.Laser,"Mesh")
waitForChild(sp,"Configuration")
lastdist=sp.Configuration.Distance.Value
dist=lastdist
running=false
function updatelaser()
if not running then
running=true
while running and sp.Laser.Transparency<1 do
sp.Laser.Transparency=sp.Laser.Transparency+.05
wait(.15)
end
running=false
end
end
updatelaser()
function raycast(spos,vec,totaldist,currentdist)
local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*(totaldist-currentdist)),sp)
if hit2~=nil and pos2 then
if hit2.Transparency>=.5 then
local currentdist=currentdist+(pos2-spos).magnitude
return raycast(pos2,vec,totaldist,currentdist)
end
end
return hit2,pos2
end
while true do
wait(1/sp.Configuration.RaysPerSecond.Value)
if sp.Base:FindFirstChild("Weld") then
lastdist=dist
local vec=((sp.Laser.CFrame*CFrame.new(0,1,0)).p-sp.Laser.Position).unit
hit,pos=raycast(sp.Laser.Position,vec,sp.Configuration.Distance.Value,0)
--hit,pos=game.Workspace:FindPartOnRay(Ray.new(sp.Laser.Position,vec*(sp.Configuration.Distance.Value)),sp)
if hit~=nil then
dist=(sp.Laser.Position-pos).magnitude
else
dist=sp.Configuration.Distance.Value
end
sp.Laser.Mesh.Scale=Vector3.new(.2,dist*(1/sp.Laser.Size.y),.2)
sp.Laser.Mesh.Offset=Vector3.new(0,(dist/2)-.1,0)
if math.abs(lastdist-dist)>leeway then
sp.Base.LaserTrigger:SetValue(1)
sp.Laser.Transparency=.5
delay(0,updatelaser)
else
sp.Base.LaserTrigger:SetValue(0)
end
--[[if math.random()<(1/15)*(1/sp.Configuration.RaysPerSecond.Value) then
sp.Laser.Transparency=.75
delay(0,updatelaser)
end]]
end
end
-
false
LightScript
--
sp=script.Parent
sp.Luminate.SourceValueChanged:connect(function(val)
if val==1 then
sp.BrickColor=BrickColor.new("New Yeller")
sp.Transparency=0
sp.Sparkles.Enabled=true
elseif val==0 then
sp.BrickColor=BrickColor.new("Medium stone grey")
sp.Transparency=.5
sp.Sparkles.Enabled=false
end
end)
-
false
MagicScript
--
sp=script.Parent
sp.ClickDetector.MouseClick:connect(function()
sp.Fire.Enabled=not sp.Fire.Enabled
if sp.Fire.Enabled then
sp.Magic:SetValue(1)
else
sp.Magic:SetValue(0)
end
end)
-
false
OrGateScript
--
sp=script.Parent
local inputs={sp.Input1:GetCurrentValue(),sp.Input2:GetCurrentValue()}
function check()
if inputs[1]>.5 and sp.Parent:FindFirstChild("Light1Color") then
sp.Parent.Light1Color.BrickColor=BrickColor.new("Dark green")
else
sp.Parent.Light1Color.BrickColor=BrickColor.new("Bright red")
end
if inputs[2]>.5 and sp.Parent:FindFirstChild("Light2Color") then
sp.Parent.Light2Color.BrickColor=BrickColor.new("Dark green")
else
sp.Parent.Light2Color.BrickColor=BrickColor.new("Bright red")
end
if inputs[1]>.5 or inputs[2]>.5 then
sp.Output:SetValue(1)
if sp.Parent:FindFirstChild("Light3Color") then
sp.Parent.Light3Color.BrickColor=BrickColor.new("Dark green")
end
else
sp.Output:SetValue(0)
if sp.Parent:FindFirstChild("Light3Color") then
sp.Parent.Light3Color.BrickColor=BrickColor.new("Bright red")
end
end
end
sp.Input1.SourceValueChanged:connect(function(val)
inputs[1]=val
check()
end)
sp.Input2.SourceValueChanged:connect(function(val)
inputs[2]=val
check()
end)
check()
-
false
PadScript
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
local pad = script.Parent
waitForChild(pad, "Base")
waitForChild(pad, "FakeBase")
waitForChild(pad, "Configuration")
waitForChild(pad.Configuration, "Height")
waitForChild(pad.Configuration, "Speed")
waitForChild(pad, "UpFacingWedge")
local base = pad.Base
local base2 = pad.FakeBase
local height = pad.Configuration.Height
local speed = pad.Configuration.Speed
local debris = game:GetService("Debris")
local r = game:GetService("RunService")
local airDir = pad.UpFacingWedge.CFrame.lookVector
-- animation variables
local continueAnimation = false
waitForChild(base, "Fire")
waitForChild(base, "Smoke")
local onColor = BrickColor.new("Toothpaste")
local offColor = BrickColor.new("Really blue")
function truncate(value)
if value < .5 then return 0
else return 1 end
end
function zeroOut(value)
if math.abs(value) < .01 then return 0
else return 1 end
end
local dX = Vector3.new(0,0,0)
local dY = base.CFrame.lookVector
local truncatedAirDir = Vector3.new(zeroOut(airDir.X), zeroOut(airDir.Y), zeroOut(airDir.Z))
function updateAirDirection()
airDir = pad.UpFacingWedge.CFrame.lookVector
dY = base.CFrame.lookVector -- we assume when upFacingWedge changes, so too does base
dX = airDir:Cross(dY)
truncatedAirDir = Vector3.new(zeroOut(airDir.X), zeroOut(airDir.Y), zeroOut(airDir.Z))
end
local debounce = false
function touchHandler(part)
if part == nil then return end
if part.Anchored then return end
while debounce do wait() end
if(part.Parent:FindFirstChild("Humanoid") ~= nil) then
-- If part is the arm or leg of a humanoid, then move everything to the torso.
-- This is so we can't double up forces on a humanoid (scripts inside each leg, arm, etc)
waitForChild(part.Parent, "Torso")
part = part.Parent.Torso
end
-- below case necessary for hats and tools (don't want to float them separately)
if (part.Parent.Parent ~= nil and part.Parent.Parent:FindFirstChild("Humanoid") ~= nil) then
waitForChild(part.Parent.Parent, "Torso")
part = part.Parent.Parent.Torso
end
debounce = true
local newBV = part:FindFirstChild("FloatMe")
if newBV ~= nil then
if math.abs(newBV.velocity:Dot(airDir)) > speed.ConstrainedValue then debounce = false return end
newBV.velocity = speed.ConstrainedValue*airDir + newBV.velocity - newBV.velocity:Dot(airDir)*airDir
newBV.maxForce = truncatedAirDir*Vector3.new(newBV.P, newBV.P, newBV.P)
else
-- make new float force
newBV = Instance.new("BodyVelocity")
newBV.Name = "FloatMe"
newBV.P = 100000
newBV.velocity = speed.ConstrainedValue * airDir
newBV.maxForce = truncatedAirDir*Vector3.new(newBV.P, newBV.P, newBV.P)
newBV.Parent = part
debris:AddItem(newBV, .5) -- force disappears after .5 seconds
end
continueAnimation = true
debounce = false
end
-- to use the region3 or raycast code, unfortunately, we still have to poll
pad.UpFacingWedge.Changed:connect(updateAirDirection)
local lastOn = 0
local curTime = 0
local wasOn = false
local baseSize = base.Size.X / 6 -- we assume square base, and want to travel 1/6 from the center, so we divide region into 3rds
while true do
continueAnimation = false
currTime = r.Stepped:wait() -- serves as the loop wait; want this to be as fast as possible
-- pass up to 4 parts (first parts caught by the rays) to our touchHandler every polling period
for xStep = -1, 1, 2 do
for yStep = -1, 1, 2 do
touchHandler(game.Workspace:FindPartOnRay(Ray.new(base.Position + xStep * dX * baseSize + yStep * dY * baseSize , height.ConstrainedValue * airDir), pad))
end
end
if continueAnimation then
base.BrickColor = onColor
base.Fire.Enabled = true
base.Smoke.Enabled = true
lastOn = currTime
wasOn = true
else
base.Fire.Enabled = false
--wait(0.5)
-- only shut off smoke and change brick color if it's been at least .5 seconds since blast pad was active
if currTime - lastOn > .5 and wasOn then
base.Smoke.Enabled = false
base.BrickColor = offColor
wasOn = false
end
end
end
-
false
PictureScript
--Stickmasterluke
sp=script.Parent
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Configuration")
waitForChild(sp,"Decal")
waitForChild(sp.Configuration,"Player Name")
playername=sp.Configuration["Player Name"]
function check()
if playername and playername.Parent~=nil and sp:FindFirstChild("Decal") then
sp.Decal.Texture="http://www.roblox.com/Thumbs/Avatar.ashx?x=200&y=200&Format=Png&username="..playername.Value
end
end
check()
playername.Changed:connect(check)
-
false
PictureScripts
--Stickmasterluke
sp=script.Parent
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Configuration")
waitForChild(sp,"Decal")
waitForChild(sp.Configuration,"Place Id")
placeid=sp.Configuration["Place Id"]
function check()
if placeid and placeid.Parent~=nil and sp:FindFirstChild("Decal") then
sp.Decal.Texture="http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=420&height=230&assetId="..placeid.Value
end
end
check()
placeid.Changed:connect(check)
-
false
PlatformScript
local platform = script.Parent
function waitForChild(parent, child)
while not parent:FindFirstChild(child) do parent.ChildAdded:wait() end
end
waitForChild(platform, "Configuration")
local config = platform.Configuration
waitForChild(config, "Time")
local maxTime = config.Time
local appearTime = 0
local platformCoroutine = nil
-- start platform off as mostly transparent
platform.Transparency = .8
platform.CanCollide = false
function runPlatform()
local timeStep = 0
while appearTime > 0 do
if (appearTime > .2 * maxTime.Value) then
-- do nothing during this time
else
-- fade out
platform.Transparency = .8*(1 - appearTime/(.2*maxTime.Value))
end
timeStep = wait()
appearTime = appearTime - timeStep
end
platform.Transparency = .8
platform.CanCollide = false
end
platform.MakeAppear.SourceValueChanged:connect(function(val)
if val > 0 then
appearTime = math.max(maxTime.Value,appearTime)
platform.Transparency = 0
platform.CanCollide = true
if not platformCoroutine or coroutine.status(platformCoroutine) == "dead" then
-- need a new coroutine
platformCoroutine = coroutine.create(runPlatform)
coroutine.resume(platformCoroutine)
end
end
end)
-
false
PlatformScrwipt
local platform = script.Parent
function waitForChild(parent, child)
while not parent:FindFirstChild(child) do parent.ChildAdded:wait() end
end
waitForChild(platform, "Configuration")
local config = platform.Configuration
waitForChild(config, "Time")
local maxTime = config.Time
local appearTime = 0
local platformCoroutine = nil
-- start platform off as normal block
platform.Transparency = 0
platform.CanCollide = true
function runPlatform()
local timeStep = 0
while appearTime > 0 do
if (appearTime > .2 * maxTime.ConstrainedValue) then
-- do nothing during this time
else
-- fade back in
platform.Transparency = 1*appearTime/(.2*maxTime.Value)
if appearTime < .1*maxTime.Value then
platform.CanCollide = true
end
end
timeStep = wait()
appearTime = appearTime - timeStep
end
platform.Transparency = 0
end
platform.MakeDisappear.SourceValueChanged:connect(function(val)
if val > .5 then
appearTime = math.max(maxTime.Value, appearTime)
platform.Transparency = 1
platform.CanCollide = false
if not platformCoroutine or coroutine.status(platformCoroutine) == "dead" then
-- need a new coroutine
platformCoroutine = coroutine.create(runPlatform)
coroutine.resume(platformCoroutine)
end
end
end)
d1=platform:FindFirstChild("Decal1")
if d1 then
d1:Remove()
end
d2=platform:FindFirstChild("Decal2")
if d2 then
d2:Remove()
end
d3=platform:FindFirstChild("Decal3")
if d3 then
d3:Remove()
end
d4=platform:FindFirstChild("Decal4")
if d4 then
d4:Remove()
end
-
false
RepeaterScript
--
sp=script.Parent
--method #1
on=false
shutdown=false
function check(val)
if val==1 then
if sp.Parent:FindFirstChild("Light1Color") then
sp.Parent.Light1Color.BrickColor=BrickColor.new("Dark green")
end
shutdown=false
if not on then
on=true
while true do
sp.RepeaterOutput:SetValue(1)
wait(sp.Configuration.TimeOn.Value)
sp.RepeaterOutput:SetValue(0)
wait(sp.Configuration.TimeOff.Value)
if shutdown then
break
end
end
shutdown=false
on=false
end
elseif val==0 then
if sp.Parent:FindFirstChild("Light1Color") then
sp.Parent.Light1Color.BrickColor=BrickColor.new("Bright red")
end
shutdown=true
end
end
sp.Input.SourceValueChanged:connect(check)
check(sp.Input:GetCurrentValue())
--method #2 con: does not start exactly when powered
--[[while true do
sp.RepeaterOutput:SetValue(sp.Input:GetCurrentValue())
wait(sp.Configuration.TimeOn.Value)
sp.RepeaterOutput:SetValue(0)
wait(sp.Configuration.TimeOff.Value)
end]]
-
false
ScriptFO
-- useless comment
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
local model = script.Parent
waitForChild(model, "PlayerNameTag")
waitForChild(model, "PlayerIdTag")
waitForChild(model, "PlayerNameTag")
waitForChild(model, "Wedge1")
waitForChild(model, "Wedge2")
waitForChild(model, "Door1")
waitForChild(model, "Door2")
waitForChild(model, "Side1")
waitForChild(model, "Side2")
waitForChild(model, "Door1Hinge1")
waitForChild(model, "Door1Hinge2")
waitForChild(model, "Door2Hinge1")
waitForChild(model, "Door2Hinge2")
waitForChild(model, "UnderDoors")
waitForChild(model, "Mode")
waitForChild(model, "Bottom")
waitForChild(model, "Head")
local doorOwnerId = model.PlayerIdTag.Value
local doorOwnerName = model.PlayerNameTag.Value
local door1 = model.Door1
local door2 = model.Door2
local wedge1 = model.Wedge1
local wedge2 = model.Wedge2
local side1 = model.Side1
local side2 = model.Side2
local top = model.Head
local head = model.Head
local bottom = model.Bottom
local underDoors = model.UnderDoors
local door1bp = model.Door1.BodyPosition
local door2bp = model.Door2.BodyPosition
local lookVector
local mode = model.Mode
local weld1 = nil
local weld2 = nil
-- SETTINGS
local offColor = BrickColor.new("Earth green")
local onColor = BrickColor.new("Lime green")
local openForce = 300 -- maxForce when off (should let doors swing)
local closedForce = 2000 -- maxForce when on (should prevent players pushing doors open)
local currentForce = closedForce
local doorOpenTime = 3
local isOpen = false
--[[
-- Owner Image stuff
waitForChild(model, "DoorSign1")
waitForChild(model.DoorSign1, "Decal")
local pic = model.DoorSign1.Decal
pic.Texture = "http://www.roblox.com/thumbs/avatar.ashx?userId=".. doorOwnerId .."&x=352&y=352"
waitForChild(model, "DoorSign2")
waitForChild(model.DoorSign2, "Decal")
local otherSide = model.DoorSign2.Decal
otherSide.Texture = "http://www.roblox.com/thumbs/avatar.ashx?userId=".. doorOwnerId .."&x=352&y=352"
--]]
function setDoorForces()
local f = lookVector * currentForce
door1bp.maxForce = f
door2bp.maxForce = f
print("door forces:", f)
end
function doorOpen()
print("doorOpen()")
isOpen = true
if(weld1 ~= nil) then weld1:Remove() end
if(weld2 ~= nil) then weld2:Remove() end
top.BrickColor = onColor
currentForce = openForce
setDoorForces()
end
function doorClose()
print("doorClose()")
isOpen = false
top.BrickColor = offColor
currentForce = closedForce
setDoorForces()
wait(0.3)
-- Weld doors
weld1 = Instance.new("Weld")
weld2 = Instance.new("Weld")
weld1.Part0 = door1
weld1.Part1 = bottom
weld2.Part0 = door2
weld2.Part1 = bottom
-- weld1.C0 = door1
-- weld1.C1 = bottom.CFrame:inverse() * door1.CFrame
-- weld2.C0 = door2
--weld2.C1 = bottom.CFrame:inverse() * door2.CFrame
weld1.C1 = CFrame.Angles(0,math.pi,0) + Vector3.new(0, 4, -1.71)
weld2.C1 = CFrame.new() + Vector3.new(0, 4, 1.71)
weld1.Parent = door1
weld2.Parent = door2
end
function testPermission2(part)
return true
end
function debug(a)
print("debug:", a)
model.Name = a
end
function testPermission(part)
print("testPermission:", part.Name)
doorOwnerId = model.PlayerIdTag.Value -- Update the owner ID
if part == nil then return false end -- In case part was deleted
local pChar = part.Parent
if pChar == nil then return false end
local pPlay = game.Players:GetPlayerFromCharacter(pChar) -- In case player left game
if not pPlay then return false end
-- Test permissions
if(mode.Value == "true" or mode.Value == "debug") then
debug("debug mode always true")
return true
elseif(mode.Value == "friend") then
if (pPlay:IsFriendsWith(doorOwnerId)) then
debug(pPlay.Name .. " is friends with " .. doorOwnerId)
return true
else
debug(pPlay.Name .. " is NOT friends with " .. doorOwnerId)
end
elseif(mode.Value == "bestFriend") then
if (pPlay:IsBestFriendsWith(doorOwnerId)) then
debug(pPlay.Name .. " is best friends with " .. doorOwnerId)
return true
else
debug("player " .. pPlay.Name .. " is NOT best friends with " .. doorOwnerId)
end
elseif(mode.Value == "group") then
if (pPlay:IsInGroup(doorOwnerId)) then
debug(pPlay.Name .. " is in group " .. doorOwnerId)
return true
else
debug(pPlay.Name .. " is NOT in group " .. doorOwnerId)
end
end
return false
end
function touchEvent(part)
print("touchEvent")
if (part ~= door1 and part ~= door2) then
if (testPermission(part)) then
if not isOpen then
doorOpen()
wait(doorOpenTime)
doorClose()
end
end
end
end
function changedEvent(prop)
-- Only interested in CFrame (position + rotation) changes
if(prop ~= "CFrame") then return end
print("positionChangedEvent()")
targetPos = underDoors.Position
door1bp.position = side2.Position
door2bp.position = side1.Position
a = underDoors.CFrame.lookVector
lookVector = Vector3.new( math.abs(a.x), math.abs(a.y), math.abs(a.z) )
setDoorForces()
end
wedge1.Touched:connect(touchEvent)
wedge2.Touched:connect(touchEvent)
door1.Touched:connect(touchEvent)
door2.Touched:connect(touchEvent)
underDoors.Changed:connect(changedEvent)
changedEvent("CFrame") -- Fire once to initialize
doorClose()
print("Events added.")
-
false
ScriptFT
function waitForChild(parent, child)
while not parent:FindFirstChild(child) do parent.ChildAdded:wait() end
end
local thisModel = script.Parent.Parent
local off_time = 0
local thread_running = false
waitForChild(thisModel, "FireSmoke")
waitForChild(thisModel, "Flamethrower")
local FIRESMOKE = thisModel.FireSmoke
local BASE = thisModel.Flamethrower
local EXTENTCHECK1 = Vector3.new(-2, -2, -2.5)
local EXTENTCHECK2 = Vector3.new(2, 2, -7.5)
function mix(v1, v2, fn)
return Vector3.new(fn(v1.x, v2.x), fn(v1.y, v2.y), fn(v1.z, v2.z))
end
-- init fire and smoke (we don't save these for state bug fix)
local fire = Instance.new("Fire")
fire.Color = Color3.new(1,128/255,0)
fire.Enabled = false
fire.Heat = 25
fire.Name = "Fire"
fire.SecondaryColor = Color3.new(1,0,0)
fire.Size = 5
fire.Archivable = false
fire.Parent = FIRESMOKE
local smoke = Instance.new("Smoke")
smoke.Color = Color3.new(95/255,95/255,95/255)
smoke.Enabled = false
smoke.Opacity = 0.2
smoke.Name = "Smoke"
smoke.RiseVelocity = 10
smoke.Size = 1
smoke.Archivable = false
smoke.Parent = FIRESMOKE
-- get player's base plate, if possible
local playerArea = thisModel.Parent
local playerBasePlate = nil
local minBoundsVect = nil
local maxBoundsVect = nil
if playerArea.Name == "PlayerArea" then
playerBasePlate = playerArea:FindFirstChild("BasePlate")
if not playerBasePlate and playerArea.Parent then playerBasePlate = playerArea.Parent:FindFirstChild("BasePlate") end
if playerBasePlate then
extent1 = playerBasePlate.CFrame:pointToWorldSpace(-playerBasePlate.Size/2)
extent2 = playerBasePlate.CFrame:pointToWorldSpace(playerBasePlate.Size/2)
minBoundsVect = mix(extent1, extent2, math.min)
minBoundsVect = Vector3.new(minBoundsVect.x, -1000, minBoundsVect.z)
maxBoundsVect = mix(extent1, extent2, math.max)
maxBoundsVect = Vector3.new(maxBoundsVect.x, 1000, maxBoundsVect.z)
end
end
function damageHumanoids()
local hitHumanoids = {}
local extent1 = BASE.CFrame:pointToWorldSpace(EXTENTCHECK1)
local extent2 = BASE.CFrame:pointToWorldSpace(EXTENTCHECK2)
local region3 = nil
if playerBasePlate then
region3 = Region3.new(
mix(mix(extent1, extent2, math.min), minBoundsVect, math.max),
mix(mix(extent1, extent2, math.max), maxBoundsVect, math.min))
else
region3 = Region3.new(
mix(extent1, extent2, math.min),
mix(extent1, extent2, math.max))
end
local parts = game.Workspace:FindPartsInRegion3(region3, thisModel)
for idx, part in ipairs(parts) do
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid and humanoid:IsA("Humanoid") then
hitHumanoids[humanoid] = true
end
end
for humanoid, unused in pairs(hitHumanoids) do
humanoid:TakeDamage(49.5)
end
end
function monitorFire()
thread_running = true
while time() <= off_time do
damageHumanoids()
wait(0.25)
end
FIRESMOKE.Fire.Enabled = false
FIRESMOKE.Smoke.Enabled = false
thread_running = false
end
script.Parent.Fire.SourceValueChanged:connect(function(val)
if val == 0 then return end
FIRESMOKE.Fire.Enabled = true
FIRESMOKE.Smoke.Enabled = true
off_time = time() + 4
if not thread_running then
delay(0, monitorFire)
end
end)
script.Parent.Parent.AncestryChanged:connect(function(child,parent)
if parent == nil then
FIRESMOKE.Fire.Enabled = false
FIRESMOKE.Smoke.Enabled = false
end
end)
-
true
ScriptHashWhitelistMaker
-- registers stampable models with the insert service on the server side of things
local baseUrl = string.lower(game:GetService("ContentProvider").BaseUrl)
local isGametest = string.find(baseUrl,"gametest")
local userIdsForStamperParts = {11744447,2409156}
if isGametest then
table.insert(userIdsForStamperParts,28215009)
table.insert(userIdsForStamperParts,28215010)
table.insert(userIdsForStamperParts,28220612)
table.insert(userIdsForStamperParts,28220614)
else
table.insert(userIdsForStamperParts,18881789)
table.insert(userIdsForStamperParts,18881808)
table.insert(userIdsForStamperParts,19238067)
table.insert(userIdsForStamperParts,19238114)
end
local userData = {}
local newTable = {}
local newHint = Instance.new("Message")
newHint.Text = "Creating Script Hash Whitelist"
newHint.Parent = game.Workspace
function getAllScriptHashes(model, myTable)
if not model then return end
if model:IsA("Script") or model:IsA("LocalScript") then
--table.insert(myTable, model:GetHash())
myTable[model:GetHash()] = true
end
-- recuRsion! the big R stands for "recuRsion"
local mc = model:GetChildren()
for i = 1, #mc do
getAllScriptHashes(mc[i], myTable)
end
end
function collectScriptsToApprove(id)
local newThing = game:GetService("InsertService"):LoadAsset(id)
getAllScriptHashes(newThing, newTable)
end
for i = 1, #userIdsForStamperParts do
local newUserData = game:GetService("InsertService"):GetUserCategories(userIdsForStamperParts[i])
if newUserData and #newUserData > 0 then
for j = 1, #newUserData do
table.insert(userData, newUserData[j])
end
end
end
local counter = 0
print("Registering script hashes.")
-- register all the good hashes :)
for index, object in pairs(userData) do
local tempSet = game:GetService("InsertService"):GetCollection(object.CategoryId)
for sIndex, sObject in pairs(tempSet) do
counter = counter + 1
local assetId = sObject.AssetId
collectScriptsToApprove(assetId)
end
end
local counter2 = 0
local newHashString = Instance.new("StringValue")
newHashString.Name = "ScriptHashWhitelist"
newHashString.Value = ""
newHashString.Parent = game.Lighting
for i,j in pairs(newTable) do
counter2 = counter2 + 1
print(counter2)
print(i)
if counter2 == 1 then newHashString.Value = newHashString.Value .. i
else newHashString.Value = newHashString.Value .. ";" .. i end
end
print("Registered " .. tostring(counter2) .. " scripts from " .. tostring(counter) .. " assets.")
newHint:Remove()
-
false
ScriptSSS
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
local trigger = script.Parent
waitForChild(script.Parent,"Configuration")
waitForChild(script.Parent.Configuration,"Trigger Reset Time")
local resetTime = script.Parent.Configuration:FindFirstChild("Trigger Reset Time")
trigger.CanCollide = false
local triggerDebounce = false
trigger.Touched:connect(function (hit)
if triggerDebounce then return end
triggerDebounce = true
trigger.Triggered:SetValue(1.0)
wait(resetTime.Value - 0.1)
trigger.Triggered:SetValue(0)
wait(0.1) -- to stop value from being immediately reset
triggerDebounce = false
end)
-- Remove decals
waitForChild(script.Parent, "Decal1")
waitForChild(script.Parent, "Decal2")
waitForChild(script.Parent, "Decal3")
waitForChild(script.Parent, "Decal4")
script.Parent.Decal1:Remove()
script.Parent.Decal2:Remove()
script.Parent.Decal3:Remove()
script.Parent.Decal4:Remove()
script.Parent.Transparency = 1
-
false
SpikeControlScript
-- V2
print("Starting SpikeControlScript")
-- offset should be between .1 and 1 inclusive, speed should be integer (0 for no movement, 1 for instant, 9 is decent speed), and delay is number of seconds to wait between shifts (so like 5, 3, or 1 for very fast are all good numbers)
local forceField = script.Parent
local SpikeModel = forceField.Parent
local box = SpikeModel.Box
local debris = game:GetService("Debris")
--local forceFieldExtent = 9.29 - 5.8 -- forceField should extend by this amount past box when stretched to its fullest extent
--local spikeExtent = 9.61 - 5.8 -- spikes should extend by this amount past box when stretched to their fullest extent
--local spikeExtent = 9.61 - 5.5
local spikeExtent = 9.61 - 5.8
local spikeWeld = box:FindFirstChild("SpikeWeld")
if spikeWeld == nil then
spikeWeld = Instance.new("ManualWeld")
spikeWeld.Name = "SpikeWeld"
spikeWeld.Part0 = box
spikeWeld.Part1 = forceField
spikeWeld.C0 = CFrame.new() + Vector3.new(0,1,0)*(spikeExtent - 3.75*0)
spikeWeld.Parent = box
end
local parts = SpikeModel:GetChildren()
local heightFactor = 1
local config = SpikeModel:FindFirstChild("Configuration")
local spikesDown = false
print("Finished Declarations")
function onTouched(hit)
if spikesDown then return end
if hit == nil then return end
if hit.Name == "Right Arm" or hit.Name == "Left Arm" then return end
local human = hit.Parent:findFirstChild("Humanoid")
if human and human:IsA("Humanoid") then
human:TakeDamage(100)
end
end
script.Parent.Touched:connect(onTouched)
--box.Anchored = true
--forceField.Anchored = true
print("Configuring Speed")
local dh = 1/9
if config ~= nil and config:FindFirstChild("Speed") ~= nil then
if config.Speed.Value == 0 then dh = .1
else dh = 1/config.Speed.Value end
end
print("Configuring Delay")
local waitTime = 3
if config ~= nil and config:FindFirstChild("Delay") ~= nil then waitTime = config.Delay.Value end
if config ~= nil and config:FindFirstChild("Offset") ~= nil then
totalTime = waitTime*2+2*.05*math.ceil(0.9/dh)
offset = config.Offset.Value
startTime = offset*totalTime
if offset == 1 then offset = 0 end
if startTime <= waitTime then
wait(waitTime - startTime + .05)
dh = -dh
heightFactor = 1 + dh
elseif startTime < waitTime+.05*math.ceil(0.9/dh) then
dh = -dh
numItersToSkip = math.floor((startTime - waitTime)/.05)
heightFactor = 1 + dh*numItersToSkip
extraTime = startTime - waitTime - numItersToSkip*.05
wait(extraTime) -- wait the extra
elseif startTime <= waitTime*2 + .05*math.ceil(0.9/dh) then
timeToWait = startTime - waitTime - .05*math.ceil(0.9/dh)
spikesDown = true
wait(waitTime - timeToWait + .05)
heightFactor = 0.1 + dh
spikesDown = false
else
timeIntoIters = startTime - waitTime*2 - .05*math.ceil(0.9/dh)
numItersToSkip = math.floor(timeIntoIters/.05)
heightFactor = 0.1 + dh*numItersToSkip
extraTime = timeIntoIters - numItersToSkip*.05
wait(extraTime)
end
if config ~= nil and config:FindFirstChild("Speed") ~= nil then
if config.Speed.Value == 0 then dh = 0 end
end
--heightFactor = config.Offset.Value
end
print("Starting Loop")
local smallVector = Vector3.new(0,0.001,0)
local loopGo = true
while loopGo do
if heightFactor >= 1 or heightFactor <= 0.1 then
if heightFactor <= 0.1 then spikesDown = true end
print("end of animation. Waiting.")
wait(waitTime)
if heightFactor <= 0.1 then
spikesDown = false
--altForceField = forceField:Clone()
--altForceField.SpikeControlScript.Disabled = true
--altForceField.SpikeScript.Disabled = false
--altForceField.Parent = SpikeModel
--debris:AddItem(altForceField, 1)
end
dh = -dh
end
heightFactor = heightFactor + dh
wait(.05)
--for i = 1, #parts do
--currPart = parts[i]
-- currPart.Anchored = true
--if currPart:FindFirstChild("Mesh") ~= nil then
--currPart.CFrame = box.CFrame + currPart.CFrame:vectorToWorldSpace(Vector3.new(0,1,0)).unit*(spikeExtent - 3.75*(1-heightFactor))
-- end
-- end
--spikeWeld.C0 = forceField.CFrame:inverse()*(box.CFrame + box.CFrame:vectorToWorldSpace(Vector3.new(0,1,0)).unit*(spikeExtent - 3.75*(1-heightFactor)))
--spikeWeld.C0 = CFrame.new() + box.CFrame:vectorToWorldSpace(Vector3.new(0,1,0)).unit*(spikeExtent - 3.75*(2-heightFactor))
if spikeWeld == nil or spikeWeld.Parent == nil then debris:AddItem(SpikeModel, 15) loopGo = false
else
spikeWeld.C0 = CFrame.new() + Vector3.new(0,1,0)*(spikeExtent - 3.75 * (1-heightFactor))
--box.CFrame = box.CFrame+Vector3.new(0,0,.01*math.random()-.005)
forceField.Mesh.VertexColor = Vector3.new(1-heightFactor*.01, 1-heightFactor*.01, 1-heightFactor*.01)
end
end
print("got here")
-
false
SpikeScript
-- useless comment
function onTouched(hit)
if not hit or not hit.Parent then return end
local human = hit.Parent:findFirstChild("Humanoid")
if human and human:IsA("Humanoid") then
human:TakeDamage(100)
end
end
script.Parent.Touched:connect(onTouched)
-
false
SwitchScript
--
sp=script.Parent
sp.ClickDetector.MouseClick:connect(function()
sp.OnOff.Value=not sp.OnOff.Value
if sp.OnOff.Value then
sp.LightSwitch:SetValue(1)
sp.SwitchWeld.C1=CFrame.Angles(.8,0,0)
else
sp.LightSwitch:SetValue(0)
sp.SwitchWeld.C1=CFrame.Angles(-.8,0,0)
end
end)
-
false
TimerScript
--Stickmasterluke
sp=script.Parent
numberids={59518377,59518402,59518433,59518457,59518480,59518522,59518607,59518632,59518651,59518670}
flashingtime=5
running=false
timer=math.ceil(sp.Configuration.Timer.Value)
function updatedisplay()
d4=timer%10
d3=math.floor((timer%60)/10)
d2=math.floor(timer/60)%10
d1=math.floor(timer/600)%10
sp.Timer1.Decal.Texture="http://www.roblox.com/asset?id="..tostring(numberids[d1+1])
sp.Timer2.Decal.Texture="http://www.roblox.com/asset?id="..tostring(numberids[d2+1])
sp.Timer3.Decal.Texture="http://www.roblox.com/asset?id="..tostring(numberids[d3+1])
sp.Timer4.Decal.Texture="http://www.roblox.com/asset?id="..tostring(numberids[d4+1])
end
function colortimer(clr)
for i,v in ipairs(sp:GetChildren()) do
if v.Name=="Color" or v.Name=="Part" or v.Name=="Wedge" then
v.BrickColor=BrickColor.new(clr)
end
end
end
function countdown()
if not running then
running=true
timer=math.ceil(sp.Configuration.Timer.Value)
colortimer("Black")
while running and timer>0 do
if timer<=flashingtime then--and timer%2==1 then
local flashtimes=(flashingtime-timer)+1
if flashtimes%2==1 then
flashtimes=flashtimes+1
end
local a=0
for i=1,flashtimes do
a=a+1
if a%2==1 then
colortimer("Really red")
else
colortimer("Black")
end
wait(1/flashtimes)
end
else
wait(1)
end
timer=timer-1
updatedisplay()
end
colortimer("Black")
sp.Antenna.TimerOutput:SetValue(1)
sp.Antenna.BrickColor=BrickColor.new("Really red")
wait(sp.Configuration.OutputTime.Value)
sp.Antenna.BrickColor=BrickColor.new("Really black")
sp.Antenna.TimerOutput:SetValue(0)
running=false
check(sp.Antenna.StartTimer:GetCurrentValue())
end
end
function check(val)
if val>.5 then
countdown()
else
--No going back. Lol
end
end
sp.Configuration.Timer.Changed:connect(function()
timer=math.ceil(sp.Configuration.Timer.Value)
updatedisplay()
end)
for i,v in ipairs(sp:GetChildren()) do
if v.Name=="Color" then
v.BrickColor=BrickColor.new("Black")
end
end
sp.Antenna.BrickColor=BrickColor.new("Really black")
sp.Antenna.TimerOutput:SetValue(0)
sp.Antenna.StartTimer.SourceValueChanged:connect(check)
check(sp.Antenna.StartTimer:GetCurrentValue())
updatedisplay()
-
false
Trapscript
function waitForChild(instance, name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
local player = nil
local door = script.Parent
--door.Anchored = true
door.CanCollide = false
local isOpen = false
local doorOpenTime = 1
--[[function accessGranted(part)
if part.Parent == nil then return false end
pPlay = game.Players:GetPlayerFromCharacter(part.Parent)
if pPlay == nil then return false end
player = part.Parent
return true
end]]--
function checkHit(part)
--if (accessGranted(part)) then
if not isOpen then
isOpen = true
wait(.3)
door.Transparency = 1
wait(doorOpenTime)
door.Transparency = 0
isOpen = false
end
end
door.Touched:connect(checkHit)
-- Remove decals
waitForChild(script.Parent, "Decal1")
waitForChild(script.Parent, "Decal2")
waitForChild(script.Parent, "Decal3")
waitForChild(script.Parent, "Decal4")
script.Parent.Decal1:Remove()
script.Parent.Decal2:Remove()
script.Parent.Decal3:Remove()
script.Parent.Decal4:Remove()