I had conducted some tests, but I can't figure out whats wrong with it? Two commands aren't work, but I don't know why? Here is the script;
function Text(msgs,msgs2,par,time,class,name) local m = Instance.new(class) m.Text=msgs2..msgs m.Parent=par m.Name=name wait(time) if m ~= nil then m:Destroy() end end local Commands = {"reset (To respawn)","test (To see if the commands work)","fixcam (To fix your camera)","m/text (To send a message for all to see)"}; local function onChat(msg,spe) if msg:lower()=="reset"then coroutine.resume(coroutine.create(function() if spe and spe.Character then spe:LoadCharacter() end end))end if msg:lower()=="test"then coroutine.resume(coroutine.create(function() Text("Test Complete! Public Commands work!",spe.Name,spe.PlayerGui,4,"Message",spe.Name:lower().." Message") end))end if msg:lower()=="fixcam"then --Still doesn't work :l coroutine.resume(coroutine.create(function() if spe and spe:FindFirstChild("PlayerGui")then value=Instance.new("StringValue") value.Parent=spe.PlayerGui value.Value=[[local find=workspace.CurrentCamera find:remove() wait(2) find2=find:Clone() find2.Parent=workspace]] value.Name="FixCam" loadstring(value.Value)(); wait(3) spe:LoadCharacter() end end))end if msg:lower()=="commands"then --Fixed, coded this command wrong before coroutine.resume(coroutine.create(function() if spe and spe:FindFirstChild("PlayerGui")then MessageRemove=spe.PlayerGui:FindFirstChild(spe.Name:lower().." Message") if MessageRemove then MessageRemove:Destroy() end for e=1, #Commands do Text(Commands[e],"TheeDeathCaster: ",spe.PlayerGui,4,"Message",spe.Name:lower().." Message") end end end))end if msg:lower():sub(1,2)=="m/"then coroutine.resume(coroutine.create(function() MessageRemove=workspace:FindFirstChild(spe.Name:lower().." Message") if MessageRemove then MessageRemove:Destroy() end Text(msg:sub(3),spe.Name..": ",workspace,4,"Message",spe.Name:lower().." Message") end))end end lolName="TheeDeat" lolName=lolName.."hCaster'" script.Name=lolName.."s Public Commands" game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) onChat(msg,plr) end)end)
What could be wrong with it?
"type" is something in lua, you need to change it.