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

How to make a wall turn on in chat?

How do you make a walls transparency 0 when a person says /WallOn in chat

3 comments

0

May you please show that you at least attempted to do this

0

I know how to make the wall turn on but Idk how to make it with the chat thing. It is game.Workspace.ScriptWall.Transparency = 0

0

At least show you attempted it... Such as the function, etc..

1 answer

✓ Accepted answer

From a ServerScript

Use the PlayerAdded event to register when a player joins.

Use the Chatted event to register when a player speaks. Then check to see what they said was a command and go from there. string.lower transforms the string in to lowercase so the command will work whether it is uppercase or not.


local wall = game.Workspace:WaitForChild "Wall"

local players = game:GetService "Players"

function chatted(msg)
	if string.lower(msg) == "wallon" then
		wall.Transparency = 0
	elseif string.lower(msg) == "walloff" then
		wall.Transparency = 1
	end
end

game.Players.PlayerAdded:connect(function(player)
	player.Chatted:connect(chatted)
end)

For group only:

Use the :GetRankInGroup function on the Player to see if that player is a certain rank. For example,

game.Players.PlayerAdded:connect(function(player)
	if player:GetRankInGroup(0 --[[GroupId]]) == 0 --[[Rank Id]] then
		player.Chatted:connect(chatted)
	end
end)

2 comments

0

Thanks so much that helped alot but is there away that you can make it so you have to be a certain rank in the group to do the commands

0

Yeah let me edit. Also can you press the correct answer button to give me some recognition? thanks

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