Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://v3rmillion.net/showthread.php?tid=1063479
- --You do need to be wearing the hat yourself
- local hatid = "HatIdHere"
- local hatname = game:GetObjects("rbxassetid://".. hatid)[1].Name
- local victimname = "VictimNameHere"
- local plrs = game:GetService("Players")
- local plr = plrs.LocalPlayer
- local hat = plr.Character:FindFirstChild(hatname)
- local hatc = hat:Clone()
- hatc.Parent = plr.Character
- local bp = Instance.new("BodyPosition", hat.Handle)
- local victim = plrs:FindFirstChild(victimname)
- local heartbeat = game:GetService("RunService").Heartbeat
- hat.Handle.AccessoryWeld:Destroy()
- hatc.Handle.Transparency = 1
- if getgenv().netted then
- if getgenv().netted == false then
- spawn(function()
- plrs.PlayerAdded:Connect(function(player)
- player.MaximumSimulationRadius = 0.1;
- sethiddenproperty(player, "SimulationRadius", 0);
- end)
- for _,player in pairs(plrs:GetPlayers()) do
- if player ~= plr then
- player.MaximumSimulationRadius = 0.1;
- sethiddenproperty(player, "SimulationRadius", 0);
- end
- end
- while true do
- heartbeat:Wait();
- settings().Physics.AllowSleep = false;
- plr.MaximumSimulationRadius = math.huge;
- if setsimulationradius then
- setsimulationradius(math.huge);
- else
- sethiddenproperty(plr, "SimulationRadius", math.huge);
- end
- end
- end)
- end
- else
- getgenv().netted = true
- spawn(function()
- plrs.PlayerAdded:Connect(function(player)
- player.MaximumSimulationRadius = 0.1;
- sethiddenproperty(player, "SimulationRadius", 0);
- end)
- for _,player in pairs(plrs:GetPlayers()) do
- if player ~= plr then
- player.MaximumSimulationRadius = 0.1;
- sethiddenproperty(player, "SimulationRadius", 0);
- end
- end
- while true do
- heartbeat:Wait();
- settings().Physics.AllowSleep = false;
- plr.MaximumSimulationRadius = math.huge;
- if setsimulationradius then
- setsimulationradius(math.huge);
- else
- sethiddenproperty(plr, "SimulationRadius", math.huge);
- end
- end
- end)
- end
- local function weld(attachment0, attachment1, part0)
- local weldpos = Instance.new("AlignPosition", part0)
- weldpos.Attachment0 = attachment0
- weldpos.Attachment1 = attachment1
- weldpos.RigidityEnabled = false
- weldpos.ReactionForceEnabled = false
- weldpos.ApplyAtCenterOfMass = false
- weldpos.MaxForce = 5000
- weldpos.MaxVelocity = 5000
- weldpos.Responsiveness = 200
- local weldrot = Instance.new("AlignOrientation", part0)
- weldrot.Attachment0 = attachment0
- weldrot.Attachment1 = attachment1
- weldrot.ReactionTorqueEnabled = true
- weldrot.PrimaryAxisOnly = false
- weldrot.MaxTorque = 1000
- weldrot.MaxAngularVelocity = 1000
- weldrot.Responsiveness = 200
- end
- local attname = hat.Handle:FindFirstChildOfClass("Attachment").Name
- if victim.Character:FindFirstChildOfClass("Humanoid").RigType == Enum.HumanoidRigType.R6 then
- if victim.Character.Torso:FindFirstChild(attname) then
- hatc.Handle.AccessoryWeld.Part1 = victim.Character.Torso
- elseif victim.Character.Head:FindFirstChild(attname) then
- hatc.Handle.AccessoryWeld.Part1 = victim.Character.Head
- end
- else
- if victim.Character.UpperTorso:FindFirstChild(attname) then
- hatc.Handle.AccessoryWeld.Part1 = victim.Character.UpperTorso
- elseif victim.Character.Head:FindFirstChild(attname) then
- hatc.Handle.AccessoryWeld.Part1 = victim.Character.Head
- end
- end
- bp.Position = hatc.Handle.Position
- bp.D = 999999999999999
- bp.P = 999999999999999999999999999999
- bp.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- spawn(function()
- repeat
- heartbeat:Wait()
- bp.Position = hatc.Handle.Position
- hat.Handle.Orientation = hatc.Handle.Orientation
- until (bp == nil)
- end)
- plr.CharacterRemoving:Connect(function()
- if (bp ~= nil) then
- bp = nil
- end
- end)
- plrs.PlayerRemoving:Connect(function(player)
- if player == victim then
- hatc:Destroy()
- hat:Destroy()
- end
- end)
- victim.CharacterAdded:Connect(function(chary)
- hatc.Handle.CanCollide = false
- hat.Handle.CanCollide = false
- repeat wait() until victim.Character:FindFirstChildOfClass("Humanoid")
- wait()
- local hum = victim.Character:FindFirstChildOfClass("Humanoid")
- if hum.RigType == Enum.HumanoidRigType.R6 then
- repeat wait() until chary:FindFirstChild("Head")
- repeat wait() until chary:FindFirstChild("Torso")
- else
- repeat wait() until chary:FindFirstChild("Head")
- repeat wait() until chary:FindFirstChild("UpperTorso")
- end
- hatc.Handle.Anchored = false
- if hum.RigType == Enum.HumanoidRigType.R6 then
- if victim.Character.Torso:FindFirstChild(attname) then
- hatc.Handle.AccessoryWeld.Part1 = victim.Character.Torso
- elseif victim.Character.Head:FindFirstChild(attname) then
- hatc.Handle.AccessoryWeld.Part1 = victim.Character.Head
- end
- else
- if victim.Character.UpperTorso:FindFirstChild(attname) then
- hatc.Handle.AccessoryWeld.Part1 = victim.Character.UpperTorso
- elseif victim.Character.Head:FindFirstChild(attname) then
- hatc.Handle.AccessoryWeld.Part1 = victim.Character.Head
- end
- end
- end)
- victim.Character:FindFirstChildOfClass("Humanoid").Died:Connect(function()
- hatc.Handle.CanCollide = true
- hat.Handle.CanCollide = true
- end)
Add Comment
Please, Sign In to add comment