-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhat_spin.lua
62 lines (51 loc) · 2.11 KB
/
hat_spin.lua
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
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local Flag = Character[shared.AccessoryName] --// Open up dex, goto your player in the workspace, and find the name of the accessory you want to use. https://coasts.cool/uploads/jrZZAH3XsA2Sp0LqjkQg.png
local Handle = Flag.Handle
local Offset = shared.Offset
local NetworkConnection = nil
NetworkConnection = RunService.RenderStepped:Connect(function()
if Character and Character:FindFirstChild("Head") then
setsimulationradius(math.huge, math.huge)
settings().Physics.AllowSleep = false
else
NetworkConnection:Disconnect()
end
end)
local FlagFloatPart = Instance.new("Part")
FlagFloatPart.Name = "FlagFloatPart"
FlagFloatPart.Parent = Character
FlagFloatPart.Anchored = true
FlagFloatPart.CanCollide = false
FlagFloatPart.Size = Vector3.new(1, 1, 1)
FlagFloatPart.Transparency = 1
local PositionConnection = nil
PositionConnection = RunService.RenderStepped:Connect(function()
if Character and Character:FindFirstChild("Head") then
FlagFloatPart.CFrame = (Character.Head.CFrame + Vector3.new(0, Offset, 0))
else
PositionConnection:Disconnect()
end
end)
Handle.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
Handle.CanCollide = false
Handle:BreakJoints()
local BodyAngularVelocity = Instance.new("BodyAngularVelocity")
BodyAngularVelocity.Parent = Handle
BodyAngularVelocity.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
BodyAngularVelocity.AngularVelocity = Vector3.new(0, -2, 0)
local AlignPosition = Instance.new("AlignPosition")
AlignPosition.Parent = Handle
AlignPosition.MaxForce = 1000000
AlignPosition.MaxVelocity = math.huge
AlignPosition.RigidityEnabled = false
AlignPosition.ApplyAtCenterOfMass = true
AlignPosition.Responsiveness = 200
local Attachment0 = Instance.new("Attachment")
Attachment0.Parent = Handle
local Attachment1 = Instance.new("Attachment")
Attachment1.Parent = FlagFloatPart
AlignPosition.Attachment0 = Attachment0
AlignPosition.Attachment1 = Attachment1