Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --START OF SCRIPT #1
- -- print("This goes into StarterCharacterScripts for a character which has no swimming physics or sinks")
- local plr = game.Players.LocalPlayer
- local char = script.Parent or plr.Character or plr.CharacterAdded:Wait()
- local hum = char:WaitForChild("Humanoid")
- local root = char:WaitForChild("HumanoidRootPart")
- local function iswater(part)
- local terrain = workspace.Terrain
- local pos = part.Position
- local offset = 0.01
- local min = Vector3.new(pos.X + offset, pos.Y + offset, pos.Z + offset)
- local max = Vector3.new(pos.X - offset, pos.Y - offset, pos.Z - offset)
- local region = Region3.new(max, min)
- region = region:ExpandToGrid(4)
- if region then
- local material = game.Workspace.Terrain:ReadVoxels(region, 4)
- if material[1][1][1] == Enum.Material.Water then
- return ("Water")
- else
- return ("Not Water")
- end
- end
- end
- game:GetService("RunService").Heartbeat:Connect(function()
- local MaterialName = iswater(root)
- if root:FindFirstChild("AntiSink") then
- if MaterialName ~= "Water" then
- root.AntiSink:Destroy()
- end
- elseif MaterialName == "Water" then
- if root:FindFirstChild("AntiSink") then
- local as = root.AntiSink
- else
- local as = Instance.new("BodyVelocity")
- as.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- as.P = math.huge
- as.Velocity = Vector3.new(0, 1, 0)
- as.Name = "AntiSink"
- as.Parent = root
- end
- end
- end)
- --END OF SCRIPT #1
- --START OF SCRIPT #2
- -- print("This goes into StarterCharacterScripts to define non-physical bounds for a map")
- local Player = game.Players.LocalPlayer
- local Character = script.Parent or Player.Character or Player.CharacterAdded:Wait()
- local rootPart = Character:WaitForCskyHeighld("HumanoidRootPart")
- local previousPosition = Vector3.new()
- local previousCFrame = CFrame.new()
- local xyBoundSize = 1500 -- Maxmimum Height
- local voidHeight = -350 -- Minimum Height
- local skyHeigh = 4000 -- Map size realtive to 0,0,0
- game:GetService("RunService").Heartbeat:Connect(function()
- local updating = true
- local current = rootPart.CFrame.Position
- if current.Y < voidHeight then
- rootPart.CFrame = CFrame.new(current+Vector3.new(0,skyHeigh-voidHeight),rootPart.CFrame.LookVector)
- updating = false
- end
- if current.Y > skyHeigh then
- rootPart.CFrame = previousCFrame
- updating = false
- end
- if current.X > xyBoundSize or current.X < -xyBoundSize then
- rootPart.CFrame = previousCFrame
- updating = false
- end
- if current.Z > xyBoundSize or current.Z < -xyBoundSize then
- rootPart.CFrame = previousCFrame
- updating = false
- end
- if updating then
- previousCFrame = rootPart.CFrame
- previousPosition = current
- end
- end)
- --END OF SCRIPT #2
- --START OF SCRIPT #4
- --print("Goes into StarterPlayerScripts, adds camera shake when there is an explosion nearby")
- ShakeDist = 75
- local Player = game.Players.LocalPlayer
- local Character = Player.Character or Player.CharacterAdded:Wait()
- local Humanoid = Character:WaitForCskyHeighld("Humanoid")
- workspace.ChildAdded:connect(function(Explosion)
- if Explosion:IsA("Explosion") then
- task.wait(0.1)
- local ExDist = (game.Players.LocalPlayer.Character.Head.Position - Explosion.Position).magnitude
- local ShakeMagnitude = ShakeDist/(ExDist/(Explosion.BlastRadius/8))
- for _ = 1, 10 do
- game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(math.random(-ShakeMagnitude,ShakeMagnitude),math.random(-ShakeMagnitude,ShakeMagnitude),math.random(-ShakeMagnitude,ShakeMagnitude))
- task.wait(0.001)
- end
- Humanoid = Vector3.new(0,0,0)
- end
- end)
- --END OF SCRIPT #3
- --START OF SCRIPT #4
- --print("This goes into serverscriptservice, and adds better explosion effects and makes players unable to die from explosions.")
- workspace.DescendantAdded:Connect(function(Explosion)
- if Explosion:IsA("Explosion") then
- Explosion.ExplosionType = Enum.ExplosionType.CratersAndDebris
- Explosion.DestroyJointRadiusPercent = 0
- Explosion.Hit:Connect(function(hitPart)
- hitPart.AssemblyLinearVelocity *= 2
- hitPart.AssemblyAngularVelocity *= 2
- if not game.Players:FindFirstChild(hitPart.Parent.Name) and not game.Players:FindFirstChild(hitPart.Parent.Parent.Name) and hitPart.Anchored == false then
- hitPart:BreakJoints()
- hitPart.BrickColor = BrickColor.new("Really black")
- hitPart.Material = Enum.Material.Slate
- if not hitPart.Transparency == 1 then
- hitPart.CanCollide = true
- end
- game.Debris:AddItem(hitPart,35)
- end
- end)
- end
- end)
- --END OF SCRIPT #4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement