Joshua
1
So when you type in !fail (player) it shows a screengui for that certain player?
Noah
2
Try shortening the title and putting it into the desc.
Then we can get to debugging.
Joshua
3
Oh okay, my bad. (This is random text because it has to be over 20 characters long)
Joshua
4
Done. I tried my best to shorten it
1 Like
Noah
5
Alright, so how do you think we detect chat commands?
Joshua
6
Local player = players.PlayerAdded:Connect(function()
player.Chatted:Connect(function(Message)
local SplitMessage = Message:split(" ")
if SplitMessage[1] == "!fail" then
Joshua
7
Is that good is does it need changes?
Noah
8
It needs changes, just bare with me…
Joshua
9
Oh okay. (This is random text because it has to be over 20 characters long)
Noah
10
When your typing these scripts do you have them inside roblox studio?
Type your code into roblox studio, then copy and paste it into code tags.
Joshua
11
I have them mostly inside of roblox studio, or sometimes I just hand type it.
Noah
12
I really recommend you take a basic coding course.
Noah
13
This is what it should look like:
game.Players.PlayerAdded:Connect(function(player) --When player joins get player instance.
player.Chatted:Connect(function(msg) --Detect when the player joined chats and get the message text.
local SplitMessage = msg:split(" ")
if SplitMessage[1] == "!fail" then
--Do task here.
end
end)
end)
Joshua
14
I’m trying to get a teacher.
1 Like
Noah
15
If you ever need some beginner help; tell me, maybe we can call on discord and I can teach you a little.
Joshua
16
Is this the next part?
game.Players.PlayerAdded:Connect(function(player) --When player joins get player instance.
player.Chatted:Connect(function(msg) --Detect when the player joined chats and get the message text.
local SplitMessage = msg:split(" ")
if SplitMessage[1] == "!fail" then
local NameOfPlayerToFail= SplitMessage[2]
local PlayerToFail = game.Players:FindFirstChild(NameOfPlayerToFail)
end
end)
end)
Noah
17
Formatting, try formatting that.
Joshua
18
Sorry, I got in huge trouble last time I used discord
Joshua
19
To me it looks like its already formatted.
Joshua
20
I’ll do it again:
game.Players.PlayerAdded:Connect(function(player) --When player joins get player instance.
player.Chatted:Connect(function(msg) --Detect when the player joined chats and get the message text.
local SplitMessage = msg:split(" ")
if SplitMessage[1] == "!fail" then
local NameOfPlayerToFail= SplitMessage[2]
local PlayerToFail = game.Players:FindFirstChild(NameOfPlayerToFail)
end
end)
end)