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