SHOW:
|
|
- or go back to the newest paste.
1 | repeat wait() until #game:GetService("Players"):GetPlayers() > 0 | |
2 | - | owner = game.Players.plytalent |
2 | + | local coms = {Instance.new("RemoteEvent",script),Instance.new("RemoteFunction",script),Instance.new("RemoteFunction",script)} |
3 | - | local com0 = Instance.new("RemoteEvent",script) |
3 | + | local FF = Instance.new("ForceField",owner.Character) |
4 | local waitremote = Instance.new('RemoteEvent',script) | |
5 | local conchar = nil | |
6 | - | -------- RAINBOW LEAVE IT TO ME |
6 | + | FF.Visible = false |
7 | - | local r = 255 |
7 | + | local comsfuncs={ |
8 | - | local g = 0 |
8 | + | function(plr, partname, partposition, partsize, partorientation) |
9 | - | local b = 0 |
9 | + | if plr ~= owner then |
10 | - | coroutine.resume(coroutine.create(function() |
10 | + | return |
11 | - | while true do |
11 | + | end |
12 | - | for i = 1, 255/5 do |
12 | + | if owner.Character.Parent then |
13 | - | game:GetService("RunService").Stepped:Wait() |
13 | + | owner.Character.Parent = nil |
14 | - | g = g + 5 |
14 | + | end |
15 | if not conchar then | |
16 | - | for i = 1, 255/5 do |
16 | + | conchar = Instance.new("Model",workspace) |
17 | - | game:GetService("RunService").Stepped:Wait() |
17 | + | hum = Instance.new("Humanoid",conchar) |
18 | - | r = r - 5 |
18 | + | hum.MaxHealth = 1 |
19 | return | |
20 | - | for i = 1, 255/5 do |
20 | + | end |
21 | - | game:GetService("RunService").Stepped:Wait() |
21 | + | if not conchar.Parent then |
22 | - | b = b + 5 |
22 | + | conchar=nil |
23 | return | |
24 | - | for i = 1, 255/5 do |
24 | + | end |
25 | - | game:GetService("RunService").Stepped:Wait() |
25 | + | if FF.Parent ~= owner.Character then |
26 | - | g = g - 5 |
26 | + | FF = Instance.new("ForceField",owner.Character) |
27 | FF.Visible = false | |
28 | - | for i = 1, 255/5 do |
28 | + | end |
29 | - | game:GetService("RunService").Stepped:Wait() |
29 | + | conchar.Name = "Ghost" |
30 | - | r = r + 5 |
30 | + | local part = conchar:FindFirstChild(partname) |
31 | if not part then | |
32 | - | for i = 1, 255/5 do |
32 | + | pcall(function() |
33 | - | game:GetService("RunService").Stepped:Wait() |
33 | + | part = Instance.new("Part",conchar) |
34 | - | b = b - 5 |
34 | + | part.Size = partsize+Vector3.new(0.125,0.125,0.125) |
35 | part.Name = partname | |
36 | - | end |
36 | + | if partname == "Head" then |
37 | - | end)) |
37 | + | local headmesh = Instance.new("SpecialMesh",part) |
38 | - | com0.OnServerEvent:Connect(function(plr,partname,partcf,partsize) |
38 | + | headmesh.Scale = Vector3.new(1.25,1.25,1.25) |
39 | - | if plr ~= owner then |
39 | + | headmesh.MeshType = Enum.MeshType.Head |
40 | - | return |
40 | + | end |
41 | - | end |
41 | + | end) |
42 | - | if not charst then |
42 | + | end |
43 | - | return |
43 | + | if part then |
44 | - | end |
44 | + | if partname == "HumanoidRootPart" then |
45 | - | if not conchar then |
45 | + | part.Transparency = 1 |
46 | - | conchar = Instance.new("Model") |
46 | + | else |
47 | - | hum = Instance.new("Humanoid",charst) |
47 | + | part.Transparency = 0.5 |
48 | - | hum.MaxHealth = 1 |
48 | + | end |
49 | - | return |
49 | + | part.Name = partname |
50 | - | end |
50 | + | part.Anchored = true |
51 | - | if not conchar.Parent then |
51 | + | part.Position = partposition |
52 | - | conchar=nil |
52 | + | part.Orientation = partorientation |
53 | - | return |
53 | + | part.Color = Color3.new(0, 0, 0) |
54 | - | end |
54 | + | end |
55 | - | conchar.Name = "Ghost" |
55 | + | end, |
56 | - | local part = conchar:FindFirstChild(partname) |
56 | + | function(plr) |
57 | - | if not part then |
57 | + | if plr ~= owner then |
58 | - | pcall(function() |
58 | + | return |
59 | - | part = Instance.new("Part",conchar) |
59 | + | end |
60 | - | part.Size = partsize + Vector3.new(0.05, 0.05, 0.05) |
60 | + | return conchar |
61 | - | part.Material = Enum.Material.ForceField |
61 | + | end, |
62 | - | if partname == "Head" then |
62 | + | function(plr,t) |
63 | - | local headmesh = Instance.new("SpecialMesh",part) |
63 | + | if plr ~= owner then |
64 | - | headmesh.Scale = Vector3.new(1.25,1.25,1.25) |
64 | + | return |
65 | - | headmesh.MeshType = Enum.MeshType.Head |
65 | + | end |
66 | - | end |
66 | + | return t |
67 | - | end) |
67 | + | end |
68 | - | end |
68 | + | } |
69 | - | if part then |
69 | + | coms[1].Name = "Com1" |
70 | - | if partname == "HumanoidRootPart" then |
70 | + | coms[2].Name = "Com2" |
71 | - | part.Transparency = 1 |
71 | + | coms[3].Name = "Com3" |
72 | waitremote.Name = "WaitRemote" | |
73 | - | part.Name = partname |
73 | + | coms[3].OnServerInvoke = comsfuncs[3] |
74 | - | part.Anchored = true |
74 | + | coms[2].OnServerInvoke = comsfuncs[2] |
75 | - | part.CFrame = partcf |
75 | + | coms[1].OnServerEvent:Connect(comsfuncs[1]) |
76 | - | part.Color = Color3.new(r/255, g/255, b/255) |
76 | + | NLS([==[ |
77 | - | end |
77 | + | local remote=script.Parent.Com1 |
78 | local com1 = script.Parent.Com2 | |
79 | - | local NLS = NLS or nil |
79 | + | local com3 = script.Parent.Com3 |
80 | - | wait(3) |
80 | + | local ping = 0.01 |
81 | - | if NLS then |
81 | + | function predict(part) |
82 | - | NLS([==[ |
82 | + | local Position = part.Position |
83 | - | local remote=script.Parent.RemoteEvent |
83 | + | local Velocity = part.Velocity |
84 | - | game:GetService("RunService").RenderStepped:Connect(function() |
84 | + | local futurePosition = Position + (Velocity * ping) |
85 | - | if game:GetService("Players").LocalPlayer.Character.Parent ~= workspace then |
85 | + | return futurePosition |
86 | - | game:GetService("Players").LocalPlayer.Character.Parent = workspace |
86 | + | end |
87 | - | end |
87 | + | spawn(function() |
88 | while wait(1) do | |
89 | - | local parttable={} |
89 | + | local start_tick=tick() |
90 | - | wait() |
90 | + | com3:InvokeServer() |
91 | - | game:GetService("RunService").Stepped:Connect(function() |
91 | + | ping = tick() - start_tick |
92 | - | coroutine.resume(coroutine.create(function() |
92 | + | |
93 | - | if workspace:FindFirstChild("Ghost") then |
93 | + | end) |
94 | - | for _,part in pairs(workspace:FindFirstChild("Ghost"):GetDescendants()) do |
94 | + | game:GetService("RunService").RenderStepped:Connect(function() |
95 | - | if part:IsA("BasePart") then |
95 | + | if game:GetService("Players").LocalPlayer.Character.Parent ~= workspace then |
96 | - | part.CanCollide = false |
96 | + | game:GetService("Players").LocalPlayer.Character.Parent = workspace |
97 | - | part.Velocity = Vector3.new(0,0,0) |
97 | + | end |
98 | - | elseif part:IsA("Humanoid") then |
98 | + | end) |
99 | - | part:Destroy() |
99 | + | local parttable={} |
100 | - | end |
100 | + | local FF |
101 | - | end |
101 | + | local prediction = false |
102 | game:GetService("Players").LocalPlayer.Chatted:Connect(function(msg) | |
103 | - | end)) |
103 | + | local args = msg:split(" ") |
104 | - | for _, part in pairs(game:GetService("Players").LocalPlayer.Character:GetChildren()) do |
104 | + | if args[1] == "PositionPredict" then |
105 | - | coroutine.resume(coroutine.create(function() |
105 | + | if args[2] then |
106 | - | local part = part |
106 | + | if args[2] == "enable" then |
107 | - | if part:IsA("BasePart") then |
107 | + | prediction = true |
108 | - | if parttable[part.Name] ~= part.CFrame then |
108 | + | elseif args[2] == "disable" then |
109 | - | parttable[part.Name] = part.CFrame |
109 | + | prediction = false |
110 | - | remote:FireServer(part.Name,part.CFrame,part.Size) |
110 | + | end |
111 | - | end |
111 | + | else |
112 | - | end |
112 | + | prediction = not prediction |
113 | - | end)) |
113 | + | end |
114 | - | end |
114 | + | end |
115 | end) | |
116 | game:GetService("RunService").Stepped:Connect(function() | |
117 | - | script.Parent.WaitRemote:FireServer() |
117 | + | coroutine.resume(coroutine.create(function() |
118 | if com1:InvokeServer() then | |
119 | for _,part in pairs(com1:InvokeServer():GetDescendants()) do | |
120 | - | elseif script:FindFirstChild("LocalScript") then |
120 | + | if part:IsA("BasePart") then |
121 | - | script.LocalScript.Disabled = false |
121 | + | part.CanCollide = false |
122 | - | end |
122 | + | part.Velocity = Vector3.new(0,0,0) |
123 | elseif part:IsA("Humanoid") then | |
124 | part:Destroy() | |
125 | end | |
126 | end | |
127 | end | |
128 | - | charst = Instance.new("Model") |
128 | + | end)) |
129 | - | hum = Instance.new("Humanoid",charst) |
129 | + | if not FF then |
130 | - | hum.MaxHealth = 1 |
130 | + | FF = Instance.new("ForceField") |
131 | - | charst.Name = "Ghost" |
131 | + | end |
132 | - | owner.Character.Parent = nil |
132 | + | if not FF.Parent then |
133 | - | conchar = charst:Clone() |
133 | + | FF = nil |
134 | - | conchar.Parent = workspace |
134 | + | end |
135 | - | |
135 | + | if FF then |
136 | FF.Visible = false | |
137 | end | |
138 | for _, part in pairs(game:GetService("Players").LocalPlayer.Character:GetChildren()) do | |
139 | coroutine.resume(coroutine.create(function() | |
140 | local part = part | |
141 | if part:IsA("BasePart") then | |
142 | if parttable[part.Name] ~= part.CFrame then | |
143 | parttable[part.Name] = part.CFrame | |
144 | --print("Firing") | |
145 | local Positionpart = part.Position | |
146 | if prediction then | |
147 | Positionpart = predict(part) | |
148 | end | |
149 | remote:FireServer(part.Name, Positionpart, part.Size, part.Orientation) | |
150 | end | |
151 | end | |
152 | end)) | |
153 | end | |
154 | end) | |
155 | script.Parent.WaitRemote:FireServer() | |
156 | ]==],script) | |
157 | ||
158 | game:GetService("RunService").Heartbeat:Connect(function() | |
159 | for i=1,#coms do | |
160 | if not coms[i].Parent then | |
161 | local ClassName = coms[i].ClassName | |
162 | coms[i] = Instance.new(ClassName,script) | |
163 | if ClassName == "RemoteEvent" then | |
164 | coms[i].OnServerEvent:Connect(comsfuncs[i]) | |
165 | elseif ClassName == "RemoteFunction" then | |
166 | coms[i].OnServerInvoke = comsfuncs[i] | |
167 | end | |
168 | end | |
169 | if coms[i].Name ~= "Com" .. tostring(i) then | |
170 | coms[i].Name = "Com" .. tostring(i) | |
171 | end | |
172 | end | |
173 | end) | |
174 | script.Parent = owner.PlayerGui | |
175 | print("waiting") | |
176 | waitremote.OnServerEvent:Wait() | |
177 | print("Destroy! wait remote") | |
178 | waitremote:Destroy() | |
179 | owner.Character.Parent = nil |