Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-3

Why wont this work!? [closed]

Asked by 9 years ago

local prefix = "!"

function playerMsg(plr,mesg,sm) -- sets function, plr being the sender, mesg being the message, and sm being whether it's a system message local players = game.Players:GetChildren() -- gets all the players for _,v in pairs (players) do -- does the following for every player local find = v.StarterGui:FindFirstChild("GUI_NAME") -- finds the gui if find then -- if the gui exists if sm == false then find.Announce.Frame.MSG.Text = mesg -- changes the text find.Announce.Frame.Type.Text = "Message" -- changes the type find.Announce.Frame.By.Text = plr.Name -- sets the text to sender's name elseif sm == true then find.Announce.Frame.MSG.Text = mesg find.Announce.Frame.Type.Text = "System Message" find.Announce.Frame.By.Text = "System Message" end end end end

game.Players.PlayerAdded:connect(unction(p) -- when a player joins p.Chatted:connect(function(msg,recipient) -- when a player talks, msg is the text, and recipient is whoever the msg is whispered to (nil if not a whisper) if msg:sub(1,prefix:len()+3) == prefix.. "m " and p:GetRankInGroup(2679030) >= 9 then -- checks to see if the first part is the prefix and 'm' print(p.Name.. " sent a message!") -- prints playerMsg(p,msg:sub(prefix:len() + 3),false) -- calls function elseif msg:sub(1,prefix:len()+4) == prefix.. "sm " and p:GetRankInGroup(2679030) >= 9 then -- you only need one 'then' playerMsg(p,msg:sub(prefix:len() + 4),true) end end) end

1
Could you put the code into Block Format? AwsomeSpongebob 350 — 9y
0
local prefix = "!" function playerMsg(plr,mesg,sm) -- sets function, plr being the sender, mesg being the message, and sm being whether it's a system message local players = game.Players:GetChildren() -- gets all the players for _,v in pairs (players) do -- does the following for every player local find = v.StarterGui:FindFirstChild("Announce") -- finds the gui if Landses 0 — 9y
0
still not in a codeblock? yoshi8080 445 — 9y

Closed as Not Constructive by 1waffle1 and M39a9am3R

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?