-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUsefulCommands
More file actions
57 lines (39 loc) · 1.61 KB
/
UsefulCommands
File metadata and controls
57 lines (39 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
wait(8)
print("Useful commands v0.2 initialized!")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local StarterGui = game:GetService("StarterGui")
local Prefix = "//"
Players.PlayerAdded:Connect(function(Player)
if Player == LocalPlayer then return false end
pcall(function()
StarterGui:SetCore("ChatMakeSystemMessage", {Text = Player.Name.." has joined the game!", Font = Enum.Font.SourceSans})
end)
end)
Players.PlayerRemoving:Connect(function(Player)
if Player == LocalPlayer then return false end
StarterGui:SetCore("ChatMakeSystemMessage", {Text = Player.Name.." has left the game!", Font = Enum.Font.SourceSans})
end)
LocalPlayer.Chatted:Connect(function(msg)
if msg:lower() == Prefix.." rejoin" then
game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, game.JobId, game:GetService("Players").LocalPlayer)
print("Rejoining")
end
end)
local mt = getrawmetatable(game)
local oldNamecall = mt.__namecall
if setreadonly then setreadonly(mt, false) else make_writeable(mt, true) end
local namecallMethod = getnamecallmethod or get_namecall_method
local newClose = newcclosure or function(f) return f end
mt.__namecall = newClose(function(...)
local method = namecallMethod()
local args = {...}
if tostring(method) == "FireServer" and tostring(args[1]) == "SayMessageRequest" then
if args[2]:sub(1,2) == Prefix then
args[1] = ""
end
return oldNamecall(unpack(args))
end
return oldNamecall(...)
end)
if setreadonly then setreadonly(mt, true) else make_writeable(mt, false) end