User:Outofspace/ON-OFF Button: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Mindraker m →Simple Toggle Utility: actually, it isn't -by- me... it was just -pointed out- by me |
>Outofspace No edit summary |
||
Line 3: | Line 3: | ||
__TOC__ | __TOC__ | ||
== | ==The Script== | ||
Changes the skybox from night to day. | |||
<pre> | <pre> | ||
--On/Off Button | --On/Off Button | ||
--OutOfSpace | --OutOfSpace | ||
script.Name = "On/Off- | --1.0b | ||
script.Name = "On/Off-Script_Version_1.0b" | |||
script.Parent = game.Workspace | |||
a = game.Workspace:GetChildren() | |||
for i = 1, #a do | |||
if a[i].Name == script.Name then | |||
a[i]:Remove() | |||
end | |||
end | |||
local b = Instance.new("Part") | local b = Instance.new("Part") | ||
b.Parent = game.Workspace | b.Parent = game.Workspace | ||
b.Name = " | b.Name = "Head" | ||
b.Size = Vector3.new(5, 1 ,5) | b.Size = Vector3.new(5, 1 ,5) | ||
local m = Instance.new("Model") | local m = Instance.new("Model") | ||
m.Parent = game.Workspace | m.Parent = game.Workspace | ||
m.Name = " | m.Name = "Waiting..." | ||
b.Parent = m | |||
local h = Instance.new("Humanoid") | local h = Instance.new("Humanoid") | ||
h.Parent = | h.Parent = m | ||
local c = Instance.new("ClickDetector") | local c = Instance.new("ClickDetector") | ||
c.Parent = | c.Parent = b | ||
c.MaxActivationDistance = 100 | c.MaxActivationDistance = 100 | ||
local s = Instance.new("Script") | local s = Instance.new("Script") | ||
s.Parent = game.Workspace | s.Parent = game.Workspace | ||
Line 66: | Line 53: | ||
isOn = true | isOn = true | ||
game.Workspace.On.Head.BrickColor = BrickColor.new(21) | game.Workspace.On.Head.BrickColor = BrickColor.new(21) | ||
game.Lighting.TimeOfDay = "00:00:00" | |||
game.Workspace.On.Name = "Off" | game.Workspace.On.Name = "Off" | ||
end | end | ||
Line 72: | Line 60: | ||
isOn = false | isOn = false | ||
game.Workspace.Off.Head.BrickColor = BrickColor.new(28) | game.Workspace.Off.Head.BrickColor = BrickColor.new(28) | ||
game.Lighting.TimeOfDay = "14:00:00" | |||
game.Workspace.Off.Name = "On" | game.Workspace.Off.Name = "On" | ||
end | end | ||
Line 87: | Line 76: | ||
s.Disabled = false | s.Disabled = false | ||
sad = s:clone() | |||
s:Remove() | |||
sad.Parent = b | |||
</pre> | </pre> | ||
Latest revision as of 03:11, 15 December 2008
Here are a few On/Off scripts/tools that you can use.
The Script
Changes the skybox from night to day.
--On/Off Button --OutOfSpace --1.0b script.Name = "On/Off-Script_Version_1.0b" script.Parent = game.Workspace a = game.Workspace:GetChildren() for i = 1, #a do if a[i].Name == script.Name then a[i]:Remove() end end local b = Instance.new("Part") b.Parent = game.Workspace b.Name = "Head" b.Size = Vector3.new(5, 1 ,5) local m = Instance.new("Model") m.Parent = game.Workspace m.Name = "Waiting..." b.Parent = m local h = Instance.new("Humanoid") h.Parent = m local c = Instance.new("ClickDetector") c.Parent = b c.MaxActivationDistance = 100 local s = Instance.new("Script") s.Parent = game.Workspace s.Disabled = true s.Name = "ButtonScript" s.Source = [[ script.Parent.Parent.Name = "On" local isOn = true function on() isOn = true game.Workspace.On.Head.BrickColor = BrickColor.new(21) game.Lighting.TimeOfDay = "00:00:00" game.Workspace.On.Name = "Off" end function off() isOn = false game.Workspace.Off.Head.BrickColor = BrickColor.new(28) game.Lighting.TimeOfDay = "14:00:00" game.Workspace.Off.Name = "On" end function onClicked() if isOn == true then off() else on() end end script.Parent.ClickDetector.MouseClick:connect(onClicked) on() ]] s.Disabled = false sad = s:clone() s:Remove() sad.Parent = b