|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 22 Sep 2012 08:18 PM |
@blackboy
Yeah, I tried that. Didn't work. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
| |
|
| |
|
|
| 23 Sep 2012 11:03 AM |
| I'll just remake your script, gimme a minute... |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|