So when you type in !fail (player) it shows a screengui for that certain player?
Try shortening the title and putting it into the desc.
Then we can get to debugging.
Oh okay, my bad. (This is random text because it has to be over 20 characters long)
Done. I tried my best to shorten it
Alright, so how do you think we detect chat commands?
Local player = players.PlayerAdded:Connect(function()
player.Chatted:Connect(function(Message)
local SplitMessage = Message:split(" ")
if SplitMessage[1] == "!fail" then
Is that good is does it need changes?
It needs changes, just bare with me…
Oh okay. (This is random text because it has to be over 20 characters long)
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.
I have them mostly inside of roblox studio, or sometimes I just hand type it.
I really recommend you take a basic coding course.
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)
I’m trying to get a teacher.
If you ever need some beginner help; tell me, maybe we can call on discord and I can teach you a little.
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)
Formatting, try formatting that.
Sorry, I got in huge trouble last time I used discord
To me it looks like its already formatted.
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)