|
| 26 Aug 2011 06:25 PM |
Why does this work in build mode but not server mode?
script 1 (workspace.Script1):
function f() print("Function Working") end
game.Workspace.ChildAdded:connect(function(c) if c.Name == "RunFunction" then f() end end)
script 2 (workspace.CurrentCamera.Script2 (Yes, this script is in the current camera in server mode. Unless you have a reason why a regular script wont run in the CurrentCamera, then don't comment on how "Blah blah blah, camera can't be accessed in server mode without a local script! blah blah blah Thank you.")):
sv=Instance.new("StringValue") sv.Name = "RunFunction" sv.Parent = workspace |
|
|
| Report Abuse |
|
|
| |
|
|
| 26 Aug 2011 07:09 PM |
| Script 2 is probably running first OR creating the object faster than script 1 has time to create the event. Therefore, the event connection never catches the new object. Add like a 'wait(0.1)' or something to script2. |
|
|
| Report Abuse |
|
|
|
| 26 Aug 2011 08:04 PM |
Well, the two scripts I posted were examples scripts for my more complex scripts. Can you please look over my real two scripts? Keep in mind that they only not work in server mode.:
Script 1 (workspace.CurrentCamera.ElevatorDoors):
DoorsService = workspace.DoorsService
delay(0,function()
DoorsService.ChildAdded:connect(function(c)
if c.Name == "FloorOpen1" then if c.Value == script.Parent.FloorNumber.Value then da = script.Parent.Door1a db = script.Parent.Door1b
for i = 1,100 do da.CFrame = da.CFrame + Vector3.new(0,0,-.2) db.CFrame = db.CFrame + Vector3.new(0,0,.2) wait() end
end end
end) end)
Script 2 (workspace.Elevator.Script):
iv=Instance.new("IntValue") iv.Name = "FloorOpen1" iv.Value = FloorNumber iv.Parent = workspace.DoorsService game:GetService("Debris"):AddItem(iv,.5) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 26 Aug 2011 09:45 PM |
| Some help would be appreciated. |
|
|
| Report Abuse |
|
|
| |
|