generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Simple open door script not working.

Previous Thread :: Next Thread 
ROBLOXHAMTAH is not online. ROBLOXHAMTAH
Joined: 08 Jul 2008
Total Posts: 9609
22 Sep 2012 07:20 PM
I don't know how to explain this. This script was working just Yesterday, and now it doesn't. I've tried reverting back and forth but it seems that it has stopped working. When the player chats "open/door1", the door become invisible and is cancollide. If the person types "close/door1" then the opposite happens:



Admins = {"ROBLOXHAMTAH"}

door1 = game.Workspace.Door.door1
door2 = game.Workspace.Door.door2

opened = false

function onChatted(msg)

if string.find(string.lower(msg), string.lower("open/")) and
string.find(string.lower(msg), string.lower("door1")) then

if not opened then

opened = true

door1.Transparency = 1
door1.CanCollide = false
door2.Transparency = 1
door2.CanCollide = false
end
end
end

if string.find(string.lower(msg), string.lower("close/")) and
string.find(string.lower(msg), string.lower("door1")) then

if opened then

door1.Transparency = 0.5
door1.CanCollide = true
door2.Transparency = 0.5
door2.CanCollide = true
end

opened = false

end
end
end

game.Players.PlayerAdded:connect(function (guy)
for i,v in pairs(Admins) do
if string.lower(guy.Name) == string.lower(v) then
guy.Chatted:connect(onChatted)
end
end
end)
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
22 Sep 2012 07:27 PM
Admins = {"ROBLOXHAMTAH"}

door1 = game.Workspace.Door.door1
door2 = game.Workspace.Door.door2

opened = false

function onChatted(msg)

if string.sub(string.lower(msg),1,6)) == "close/" and string.sub(string.lower(msg),7,11)) == "door1" then

if opened == false then

opened = true

door1.Transparency = 1
door1.CanCollide = false
door2.Transparency = 1
door2.CanCollide = false
end
end
end

if string.sub(string.lower(msg),1,6)) == "close/" and string.sub(string.lower(msg),7,11)) == "door2" then

if opened then

door1.Transparency = 0.5
door1.CanCollide = true
door2.Transparency = 0.5
door2.CanCollide = true
end

opened = false

end
end
end

game.Players.PlayerAdded:connect(function (guy)
for i,v in pairs(Admins) do
if string.lower(guy.Name) == string.lower(v) then
guy.Chatted:connect(onChatted)
end
end
end)
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
22 Sep 2012 07:42 PM
Ok, I am not going through a script of that size but I did notice one thing at a glance, in the line:

game.Players.PlayerAdded:connect(function (guy)

You need to remove the space between function and (guy) so it will look like:

game.Players.PlayerAdded:connect(function(guy)
Report Abuse
ROBLOXHAMTAH is not online. ROBLOXHAMTAH
Joined: 08 Jul 2008
Total Posts: 9609
22 Sep 2012 08:18 PM
@blackboy

Yeah, I tried that. Didn't work.
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
22 Sep 2012 08:26 PM
Bah, Read through your script, noticed a simple mistypeing as well as waaay too many ends in the function onChatted... fixed script:

Admins = {"ROBLOXHAMTAH"}

door1 = game.Workspace.Door.door1
door2 = game.Workspace.Door.door2

opened = false

function onChatted(msg)

if string.sub(string.lower(msg),1,5) == "open/" and string.sub(string.lower(msg),6,10) == "door1" then

if opened == false then

opened = true

door1.Transparency = 1
door1.CanCollide = false
door2.Transparency = 1
door2.CanCollide = false
end
end

if string.sub(string.lower(msg),1,6) == "close/" and string.sub(string.lower(msg),7,11) == "door2" then

if opened then

door1.Transparency = 0.5
door1.CanCollide = true
door2.Transparency = 0.5
door2.CanCollide = true
end

opened = false

end
end

game.Players.PlayerAdded:connect(function(guy)
for i,v in pairs(Admins) do
if string.lower(guy.Name) == string.lower(v) then
guy.Chatted:connect(onChatted)
end
end
end)
Report Abuse
ROBLOXHAMTAH is not online. ROBLOXHAMTAH
Joined: 08 Jul 2008
Total Posts: 9609
22 Sep 2012 09:28 PM
@chris

Didn't work.
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
22 Sep 2012 09:56 PM
You know this script is extremely flawed as it is hard to use, as well as it is hard to troubleshoot, do you have anything from output?
Report Abuse
ROBLOXHAMTAH is not online. ROBLOXHAMTAH
Joined: 08 Jul 2008
Total Posts: 9609
23 Sep 2012 09:54 AM
Nope.
Report Abuse
ROBLOXHAMTAH is not online. ROBLOXHAMTAH
Joined: 08 Jul 2008
Total Posts: 9609
23 Sep 2012 11:02 AM
Bump.
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
23 Sep 2012 11:03 AM
I'll just remake your script, gimme a minute...
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
23 Sep 2012 11:12 AM
Try this...

Admins = {"ROBLOXHAMTAH"}

d1 = game.Workspace.Door.door1
d2 = game.Workspace.Door.door2

d1opened = false
d2opened = false

function Open(door, open)
if open == false then
door.Transparency = 1
door.CanCollide = false
open = true
end
end

function Close(door, open)
if open == true then
door.Transparency = 0.5
door.CanCollide = true
open = false
end
end

function onChatted(msg)
if string.sub(string.lower(msg),1,5) == "open/" then
if string.sub(string.lower(msg),6,10) == "door1" then
Open(d1,d1opened)
end
if string.sub(string.lower(msg),6,10) == "door2" then
Open(d2,d2opened)
end
end
if string.sub(string.lower(msg),1,6) == "close/" then
if string.sub(string.lower(msg),7,11) == "door1" then
Close(d1,d1opened)
end
if string.sub(string.lower(msg),7,11) == "door2" then
Close(d2,d2opened)
end
end
end

game.Players.PlayerAdded:connect(function(newPlayer)
Admin = false
for i=1, #Admins do
if string.lower(newPlayer.Name) == string.lower(Admins[i]) then
Admin = true
end
end
if Admin then
newPlayer.Chatted:connect(onChatted)
end
end)
Report Abuse
ROBLOXHAMTAH is not online. ROBLOXHAMTAH
Joined: 08 Jul 2008
Total Posts: 9609
23 Sep 2012 05:22 PM
Not working, btw stop changing the commands. I want "open/door1" to open both the doors. Don't make them seperate commands.

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image