Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make this script stop resetting me after I say "party"?

I said party to open the door. The door is called Voice Door. Well, I activated the game, and tested it out by saying "party". Well, what it did was it opened, but it reset-ed me or "killed" me and took me back to the spawner. This is what the script looks like on the door:

door = script.Parent --this is the door 

function onChatted(msg, recipient, speaker) 

-- convert to all lower case 

local source = string.lower(speaker.Name) 
msg = string.lower(msg) 

if (msg == "party") then 
door.CanCollide = false 
door.Transparency = 0.7 
wait(5) 
door.CanCollide = true 
door.Transparency = 0 
end 

end 

function onPlayerEntered(newPlayer) 
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered) 

Please fix it.

1 answer

✓ Accepted answer

i don't see why that script would in any instance kill you or respawn you. Are you entirely sure this is the script causing the issue? Are there any other scripts in the door we should know about?

A simplified script for opening the door:

--[[ assuming this is a Script, not a LocalScript (I don't see why it would be LS)
This script takes use of anonymous functions. That means the functions aren't assigned a name and cannot be called explicitly. It's called straightly in the Event.

Anonymous func:
script.Parent.Touched:connect(function(hit) print(hit.Name) end)

Regular function and connection line:
function onTouch(hit) 
     print(hit.Name)
end
script.Parent.Touched:connect(onTouch)


They function the same way, but a regular function can be called several times globally in the script (unless it's a local function).

]]
local door = script.Parent
game.Players.PlayerAdded:connect(function(player)
``player.Chatted:connect(function(msg) -- I'm not using the recipient parameter, so I'm not assigning it in the function header
````if (msg:lower() == "party") then -- string.lower(msg) can be written as msg:lower() - personal preference here!
``````door.CanCollide = false
``````door.Transparency = 0.7
``````wait(5)
``````door.CanCollide = true
``````door.Transparency = 0
````end
``end)
end)

3 comments

1

Why use the ' for you tabs? Just use the tab key, lol.

0

I agree Lol

0

Writing on iPhone - tab doesn't exist there (as far as I know) ;-)

This discussion is preserved as it was. New answers, comments, and votes are closed.