|
Ummm I need script for my night ap..I want lights..and when you enter an room and pull down the level all lights on map go down...and vice versa..How can I do that..Please help ..Pm me..Thanks |
|
devTreeJoin Date: 2012-12-26 Post Count: 2596 |
Please type that properly and I may consider your post. |
|
|
|
Go to this forum called "Scripting Helpers" instead:
http://www.roblox.com/Forum/ShowForum.aspx?ForumID=20
Because this post here is in the "Scripters" which is not for help requests. |
|
|
While true do
print("Turn lights on")
end
|
|
darkwispJoin Date: 2010-04-07 Post Count: 22653 |
"While true do
print("Turn lights on")
end"
That will crash the game.
But seriously, join The Collision. |
|
CoinyeJoin Date: 2010-07-19 Post Count: 4347 |
repeat
print("Lights on")
print("Lights off")
until nil |
|
mathchampJoin Date: 2007-10-22 Post Count: 320 |
local on = true
local switch = game.Workspace:WaitForChild("Switch")
function GetLights(m,lights)
local lights = lights or {}
for i,v in ipairs(m:GetChildren()) do
GetLights(v,lights)
end
if m:IsA("Light") then table.insert(lights,m) end
return lights
end
local lights = GetLights(workspace)
game.Players.ChildAdded:connect(function(newPlayer)
newPlayer.Changed:connect(function(p)
if p == "Character" and p.Character then
pcall(function()
local h = p:WaitForChild("Humanoid")
h.Clapped:connect(function()
if h.Parent then
local t = h:FindFirstChild("HumanoidRootPart")
if t and (t.Position-switch.Position).magnitude < 128 then
on = not on
if on then print("Clap on!") else print("Clap off!") end --fair use
for i,v in ipairs(lights) do
v.Enabled = on
end
end
end
end)
end)
end
end)
end)
print("The clapper!") --more fair use
We tend to make fun of people who post help topics in Scripters. Head over to Scripting Helpers and people there will be glad to assist you. ;) |
|
|
Mathchamp good job I'm so very tired of scripters making fun of beginner scripters.
We all started from the bottom guys and you dudes know how scripting can be difficult at times so don't be a jerk and help out those in need! |
|
mathchampJoin Date: 2007-10-22 Post Count: 320 |
Well my script isn't a real solution. It's still a joke script, but technically it works except that Clapped isn't a real event.
Since someone thought I posted a serious script, I'm going to actually post a serious script now. However, I recommend that the original poster go to Scripting Helpers in the future, as they will get assistance much more quickly there and will not be breaking forum rules by posting there.
What one should really do is the following:
1. Put all the parts that contain the lights you want to switch inside a model.
2. Insert a Part inside the model to be the switch.
3. Inside the switch part, insert a ClickDetector and a Script.
4. Put the following in the script:
local on = true --replace with false if you want the lights to start in the 'off' state
local switch = script.Parent
function GetLights(m,lights)
local lights = lights or {}
for i,v in ipairs(m:GetChildren()) do
GetLights(v,lights)
end
if m:IsA("Light") then table.insert(lights,m) end
return lights
end
local lights = GetLights(switch.Parent)
function UpdateLights()
for i,v in ipairs(lights) do
v.Enabled = on
end
end
switch.ClickDetector.MouseClick:connect(function()
on = not on
UpdateLights()
end)
UpdateLights()
--end of script
If you are having an issue where some or all of the lights are being ignored by the switch, put a small wait before the first line, i.e.:
wait(0.5)
local on = true
local switch = script.Parent
... |
|
|
@mista
It doesn't matter if their a beginner or not, this belongs in the scripting helpers subforum.
If they disobey the rules they deserve to get trolled. |
|
money1Join Date: 2007-11-29 Post Count: 178 |
I thought you all would have noticed that mista can't skropt. |
|
mathchampJoin Date: 2007-10-22 Post Count: 320 |
Well yes, because anyone who knew how to script would know that my first script was a joke. |
|
money1Join Date: 2007-11-29 Post Count: 178 |
Ding ding ding, we have a winner! |
|
|
First of all don't dis a girl when you don't even know them. Second I just noticed that script was a joke. Third of all I am an advanced scripter. Fourth of all if you want me to prove that I'm a scripter hook me up and PM me a message!
Thank you -.- |
|
devTreeJoin Date: 2012-12-26 Post Count: 2596 |
u w0t m8 |
|