-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScript
More file actions
226 lines (200 loc) · 7.42 KB
/
Script
File metadata and controls
226 lines (200 loc) · 7.42 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
local p = game.Players.LocalPlayer
local Tool = Instance.new("Tool")
Tool.Name = "Fire Parts"
Tool.RequiresHandle = false
local function keepToolEnabled()
if not p.Backpack:FindFirstChild("Fire Parts") then
Tool.Parent = p.Backpack
end
Tool.Parent = p.Backpack
Tool.Activated:Connect(function()
local mouse = p:GetMouse()
local target = mouse.Target
if target and target:IsA("Part") then
local touchInterest = target:FindFirstChildOfClass("TouchTransmitter")
if touchInterest then
firetouchinterest(p.Character.PrimaryPart, target, 0)
firetouchinterest(p.Character.PrimaryPart, target, 1)
end
end
end)
end
p.CharacterAdded:Connect(function()
task.wait(0.1)
keepToolEnabled()
end)
keepToolEnabled()
--camera
local CoreGui = game:GetService("StarterGui")
local onMobile = not game:GetService("UserInputService").KeyboardEnabled
local keysDown = {}
local rotating = false
local ActiveFreecam = false
if not game:IsLoaded() then
game.Loaded:Wait()
end
local speed = 5
local sens = 0.3
speed /= 10
if onMobile then
sens*=2
end
local function renderStepped()
if ActiveFreecam == true then
if rotating then
local delta = game:GetService("UserInputService"):GetMouseDelta()
local cf = workspace.CurrentCamera.CFrame
local yAngle = cf:ToEulerAngles(Enum.RotationOrder.YZX)
local newAmount = math.deg(yAngle)+delta.Y
if newAmount > 65 or newAmount < -65 then
if not (yAngle<0 and delta.Y<0) and not (yAngle>0 and delta.Y>0) then
delta = Vector2.new(delta.X,0)
end
end
cf *= CFrame.Angles(-math.rad(delta.Y),0,0)
cf = CFrame.Angles(0,-math.rad(delta.X),0) * (cf - cf.Position) + cf.Position
cf = CFrame.lookAt(cf.Position, cf.Position + cf.LookVector)
if delta ~= Vector2.new(0,0) then workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame:Lerp(cf,sens) end
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
else
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.Default
end
if keysDown["Enum.KeyCode.W"] then
workspace.CurrentCamera.CFrame *= CFrame.new(Vector3.new(0,0,-speed))
end
if keysDown["Enum.KeyCode.A"] then
workspace.CurrentCamera.CFrame *= CFrame.new(Vector3.new(-speed,0,0))
end
if keysDown["Enum.KeyCode.S"] then
workspace.CurrentCamera.CFrame *= CFrame.new(Vector3.new(0,0,speed))
end
if keysDown["Enum.KeyCode.D"] then
workspace.CurrentCamera.CFrame *= CFrame.new(Vector3.new(speed,0,0))
end
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:Disable()
end
end
game:GetService("RunService").RenderStepped:Connect(renderStepped)
local validKeys = {"Enum.KeyCode.W","Enum.KeyCode.A","Enum.KeyCode.S","Enum.KeyCode.D"}
game:GetService("UserInputService").InputBegan:Connect(function(Input)
if ActiveFreecam == true then
for i, key in pairs(validKeys) do
if key == tostring(Input.KeyCode) then
keysDown[key] = true
end
end
if Input.UserInputType == Enum.UserInputType.MouseButton2 or (Input.UserInputType == Enum.UserInputType.Touch and game:GetService("UserInputService"):GetMouseLocation().X>(workspace.CurrentCamera.ViewportSize.X/2)) then
rotating = true
end
if Input.UserInputType == Enum.UserInputType.Touch then
if Input.Position.X < workspace.CurrentCamera.ViewportSize.X/2 then
touchPos = Input.Position
end
end
end
end)
game:GetService("UserInputService").InputEnded:Connect(function(Input)
if ActiveFreecam == true then
for key, v in pairs(keysDown) do
if key == tostring(Input.KeyCode) then
keysDown[key] = false
end
end
if Input.UserInputType == Enum.UserInputType.MouseButton2 or (Input.UserInputType == Enum.UserInputType.Touch and game:GetService("UserInputService"):GetMouseLocation().X>(workspace.CurrentCamera.ViewportSize.X/2)) then
rotating = false
end
if Input.UserInputType == Enum.UserInputType.Touch and touchPos then
if Input.Position.X < workspace.CurrentCamera.ViewportSize.X/2 then
touchPos = nil
keysDown["Enum.KeyCode.W"] = false
keysDown["Enum.KeyCode.A"] = false
keysDown["Enum.KeyCode.S"] = false
keysDown["Enum.KeyCode.D"] = false
end
end
end
end)
game:GetService("UserInputService").TouchMoved:Connect(function(input)
if ActiveFreecam == true then
if touchPos then
if input.Position.X < workspace.CurrentCamera.ViewportSize.X/2 then
if input.Position.Y < touchPos.Y then
keysDown["Enum.KeyCode.W"] = true
keysDown["Enum.KeyCode.S"] = false
else
keysDown["Enum.KeyCode.W"] = false
keysDown["Enum.KeyCode.S"] = true
end
if input.Position.X < (touchPos.X-15) then
keysDown["Enum.KeyCode.A"] = true
keysDown["Enum.KeyCode.D"] = false
elseif input.Position.X > (touchPos.X+15) then
keysDown["Enum.KeyCode.A"] = false
keysDown["Enum.KeyCode.D"] = true
else
keysDown["Enum.KeyCode.A"] = false
keysDown["Enum.KeyCode.D"] = false
end
end
end
end
end)
--------Freecam Gui
local ScreenGui1 = Instance.new("ScreenGui")
ScreenGui1.Parent = game.CoreGui
local ImageButton1 = Instance.new("ImageButton")
ImageButton1.Parent = ScreenGui1
ImageButton1.Position = UDim2.new(0.9,0,0.2)
ImageButton1.BackgroundColor3 = Color3.new(0,0,0)
ImageButton1.BackgroundTransparency = 0.5
ImageButton1.Size = UDim2.new(0.07,0,0.16)
ImageButton1.Image = "rbxassetid://6282915548"
ImageButton1.Draggable = true
local UIStroke1 = Instance.new("UIStroke")
UIStroke1.Parent = ImageButton1
UIStroke1.Transparency = 0
UIStroke1.Color = Color3.new(1,1,1)
UIStroke1.Thickness = 2
local UICorner1 = Instance.new("UICorner")
UICorner1.Parent = ImageButton1
UICorner1.CornerRadius = UDim.new(0.2,0)
local ButtonPressedTime = 0
local ButtonPressed = false
ImageButton1.MouseButton1Down:Connect(function()
ButtonPressedTime = 0
ButtonPressed = true
while ButtonPressed == true do wait(0.1)
ButtonPressedTime += 1
end
end)
ImageButton1.MouseButton1Up:Connect(function()
ButtonPressed = false
if ButtonPressedTime <= 0.5 then
ButtonPressedTime = 0
if ActiveFreecam == false then
ActiveFreecam = true
else
ActiveFreecam = false
workspace.CurrentCamera.CameraType = Enum.CameraType.Follow
local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:Enable()
end
end
end)
--creator
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local userId = Players:GetUserIdFromNameAsync("IEnesxvc")
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
if isReady then
StarterGui:SetCore("SendNotification", {
Title = "Made By IEnes",
Text = "Thanks for using my script.",
Icon = content,
Duration = 7
})
end