View difference between Paste ID: h6sVmbUV and tMr759X7
SHOW: | | - or go back to the newest paste.
1
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
2
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
3
do
4
5
	script.Parent = Player.Character
6
7
	--RemoteEvent for communicating
8
	local Event = Instance.new("RemoteEvent")
9-
local p = game.Players.LocalPlayer.Character
9+
	Event.Name = "UserInput_Event"
10-
local weld = Instance.new("Weld",p.Torso)
10+
11-
weld.Part0 = p.Torso
11+
	--Fake event to make stuff like Mouse.KeyDown work
12
	local function fakeEvent()
13-
local train = Instance.new("Part",p.Torso)
13+
		local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
14
		t.connect = t.Connect
15
		return t
16
	end
17
18
	--Creating fake input objects with fake variables
19
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
20
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
21
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
22
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
23
	end}
24
	--Merged 2 functions into one by checking amount of arguments
25
	CAS.UnbindAction = CAS.BindAction
26
27
	--This function will trigger the events that have been :Connect()'ed
28
	local function te(self,ev,...)
29-
weld2.Part0 = p.Torso
29+
		local t = m[ev]
30
		if t and t._fakeEvent and t.Function then
31
			t.Function(...)
32
		end
33
	end
34
	m.TrigEvent = te
35
	UIS.TrigEvent = te
36
37
	Event.OnServerEvent:Connect(function(plr,io)
38
	    if plr~=Player then return end
39
		if io.isMouse then
40
			m.Target = io.Target
41
			m.Hit = io.Hit
42
		else
43
			local b = io.UserInputState == Enum.UserInputState.Begin
44
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
45
				return m:TrigEvent(b and "Button1Down" or "Button1Up")
46
			end
47
			for _,t in pairs(CAS.Actions) do
48
				for _,k in pairs(t.Keys) do
49
					if k==io.KeyCode then
50
						t.Function(t.Name,io.UserInputState,io)
51
					end
52-
p.Humanoid.WalkSpeed = 60;
52+
53
			end
54
			m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
55
			UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
56
	    end
57
	end)
58
	Event.Parent = NLS([==[
59
	local Player = game:GetService("Players").LocalPlayer
60
	local Event = script:WaitForChild("UserInput_Event")
61
62
	local UIS = game:GetService("UserInputService")
63
	local input = function(io,a)
64
		if a then return end
65
		--Since InputObject is a client-side instance, we create and pass table instead
66
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
67-
	if p.Parent then
67+
68
	UIS.InputBegan:Connect(input)
69
	UIS.InputEnded:Connect(input)
70
71
	local Mouse = Player:GetMouse()
72
	local h,t
73
	--Give the server mouse data 30 times every second, but only if the values changed
74
	--If player is not moving their mouse, client won't fire events
75
	while wait(1/30) do
76
		if h~=Mouse.Hit or t~=Mouse.Target then
77
			h,t=Mouse.Hit,Mouse.Target
78
			Event:FireServer({isMouse=true,Target=t,Hit=h})
79
		end
80
	end]==],Player.Character)
81
	Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
82
end
83
84
-- ty krystalburger
85
--[[
86
	Thomas The Dank Engine:
87
							By: KrystalTeam
88
							Features: Being a dank engine that kill people
89
							Version: 1.0.0.2
90
--]]
91
92
local plr = owner
93
local char = plr.Character
94
local Humanoid = char.Humanoid
95
local Backpack = plr.Backpack
96
local ra = char["Right Arm"]
97
local la= char["Left Arm"]
98
local rl= char["Right Leg"]
99
local ll = char["Left Leg"]
100
local hed = char.Head
101
local root = char.HumanoidRootPart
102
local rootj = root.RootJoint
103
local tors = char.Torso
104
local RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
105
local RHCF = CFrame.fromEulerAnglesXYZ(0, 0, 0)
106
local LHCF = CFrame.fromEulerAnglesXYZ(0, 0, 0)
107
wait(0.1)
108
109
local train = Instance.new("Part",plr.Torso)
110
train.Anchored = true
111
train.CanCollide = false
112
train.Size = Vector3.new(3,2,6)
113
train.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0)
114
weld.Part1 = train
115
weld.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(180),0)
116
train.Anchored = false
117
local TrainMesh = Instance.new("SpecialMesh",train)
118
TrainMesh.MeshType = Enum.MeshType.FileMesh
119
TrainMesh.Scale = Vector3.new(0.020,0.020,0.015)
120
TrainMesh.MeshId = "rbxassetid://431017802"
121
TrainMesh.TextureId = "rbxassetid://431017809"
122
123
pumpk = Instance.new("Sound")
124
pumpk.Parent = plr.Character.Head
125
pumpk.SoundId = "rbxassetid://2862170886"
126
pumpk.Volume = 6
127
pumpk.Looped = true
128
pumpk:Play()
129
130
131
local weld2 = Instance.new("Weld",p.Torso)
132
weld2.Part0 = plr.Torso
133
local Smoke = Instance.new("Part",p.Torso)
134
Smoke.Anchored = true
135
Smoke.CanCollide = false
136
Smoke.Size = Vector3.new(1,1,1)
137
Smoke.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0)
138
weld2.Part1 = Smoke
139
weld2.C1 = CFrame.new(0,-4,3.5)-- * CFrame.Angles(0,math.rad(180),0)
140
Smoke.Anchored = false
141
Smoke.Transparency = 1;
142
143
local Particle = Instance.new("ParticleEmitter",Smoke)
144
Particle.Rate = 50;
145
Particle.Speed = NumberRange.new(30,60);
146
Particle.VelocitySpread = 4;
147
Particle.Texture = "rbxassetid://133619974"
148
149
150
151
local Light = Instance.new("SpotLight",train)
152
Light.Angle = 45;
153
Light.Brightness = 100;
154
Light.Face = Enum.NormalId.Back;
155
Light.Range = 30;
156
157
plr.Humanoid.WalkSpeed = 60;
158
159
160
for i,v in pairs(p:GetChildren()) do
161
	if v:IsA("Part") then
162
		v.Transparency = 1;
163
	elseif v:IsA("Hat") then
164
		v:Destroy()
165
	elseif v:IsA("Model") then
166
		v:Destroy()
167
	end
168
end
169
170
local function SFX(id) local s=Instance.new("Sound",p.Torso); s.SoundId = "rbxassetid://"..id; s.Volume = 1; return s; end
171
train.Touched:connect(function(p)
172
	if plr.Parent then
173
		if p.Parent:IsA("Model") then
174
			if game.Players:FindFirstChild(p.Parent.Name) then
175
				if p.Parent.Name ~= game.Players.LocalPlayer.Name then
176
					game.Players:FindFirstChild(p.Parent.Name).Character:BreakJoints()
177
					local Whistle = SFX(475073913)
178
					Whistle:Play()
179
				end
180
			end
181
		end
182
	end
183
end)
184
185
local Music = SFX(190819252)
186
Music.Looped = true;
187
wait(1)
188
Music:Play();
189
-- ~CL 2016