I want to have all Roblox packages be supported on my game.
It appears that some packages have issues with my game, but only on the Roblox app. This includes the new Windows 10 app, along with the app for mobile devices.
Packages I have had issues with:
Man / Woman packages,
Any Rthro package
This code is the code that finds the player’s velocity.
local PlayerHumanoidRootPart = Humanoid.Parent:FindFirstChild("HumanoidRootPart")
if PlayerHumanoidRootPart then
_G.PlayerVelocity = PlayerHumanoidRootPart.AssemblyLinearVelocity.Y -- Gets player's -/+ vertical speed
end
Later, the script checks if the player is going too fast.
if _G.PlayerVelocity <= -65 then
As stated before, this works for all other packages that aren’t listed above. What could be causing this?
All of this code is inside a local script and is in a renderstepped event.
You can test this issue for yourself in my game.
Full script:
local Humanoid = script.Parent:FindFirstChild("Humanoid")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local BloodParticle = ReplicatedStorage.ThisHurts
local DeathValueChanged = ReplicatedStorage.DeathValueChanged
local Dismember = ReplicatedStorage.Dismember
local Dismember2 = ReplicatedStorage.Dismember2
local Dismember3 = ReplicatedStorage.Dismember3
local BadgeAward = ReplicatedStorage.BadgeAward
local TerminalVelocity1 = ReplicatedStorage.TerminalVelocity1
local PlayerObject = game.Players.LocalPlayer
local HasCreatedbodyVelocity = false
local PlayerOriginalFace = Humanoid.Parent.Head.face.Texture
local Camera = game.Workspace.CurrentCamera
local OverHeadChange = ReplicatedStorage.OverHeadChange
_G.Scream = game.Workspace.SFX.Falling
_G.AirTime = 0
local Debounce1 = true
local Debounce2 = true
local Debounce3 = true
local Debounce4 = true
local Goal1 = {
FieldOfView = 120
}
local Goal2 = {
FieldOfView = 70
}
local FallingFOVTween = TweenService:Create(Camera, TweenInfo.new(1), Goal1)
local LandedFOVTween = TweenService:Create(Camera, TweenInfo.new(0.1), Goal2)
RunService.RenderStepped:Connect(function(step)
local PlayerHumanoidRootPart = Humanoid.Parent:FindFirstChild("HumanoidRootPart")
if PlayerHumanoidRootPart then
_G.PlayerVelocity = PlayerHumanoidRootPart.AssemblyLinearVelocity.Y -- Gets player's -/+ vertical speed
end
Humanoid:GetPropertyChangedSignal("Health"):Connect(function() -- Changes health HUD number
if Humanoid.Health >= 0 then
local HumanoidFixedHealth = math.ceil(Humanoid.Health)
PlayerObject.PlayerGui.HealthMenu.PlayerHealth.HealthCounter.Text = HumanoidFixedHealth
PlayerObject.PlayerGui.HealthMenu.PlayerHealth.HealthCounter.TextColor3 = Color3.fromRGB(255,0,0)
wait(1)
PlayerObject.PlayerGui.HealthMenu.PlayerHealth.HealthCounter.TextColor3 = Color3.fromRGB(255,247,0)
end
end)
if Humanoid.Health <= 0 and Debounce1 then -- Changes leaderstats serverside
Debounce1 = false
DeathValueChanged:FireServer()
wait(10)
Debounce1 = true
end
-- Ragdoll when falling too fast & add fake wind physics
if _G.PlayerVelocity <= -65 then
local PlayerHead42 = Humanoid.Parent:FindFirstChild("Head")
game.Workspace.SFX.Wind.Playing = true
_G.playerLastSpeed = _G.PlayerVelocity
if not HasCreatedbodyVelocity and Humanoid.Health > 0 then -- If player isn't dead and script hasn't created bodyvelocity
LandedFOVTween:Cancel() -- Makes sure FOV tween isn't playing
Humanoid:ChangeState(Enum.HumanoidStateType.Physics) -- Ragdolls player
HasCreatedbodyVelocity = true
local RandomScream = math.random(1,3)
print("Players scream is: ".. RandomScream)
FallingFOVTween:Play()
if RandomScream == 1 then
_G.Scream = game.Workspace.SFX.Falling
elseif RandomScream == 2 then
_G.Scream = game.Workspace.SFX.Falling2
elseif RandomScream == 3 then
_G.Scream = game.Workspace.SFX.Falling3
end
local Scream = _G.Scream:Clone()
if PlayerHead42 then
Scream.Parent = Humanoid.Parent.Head
Scream.Playing = true
Humanoid.Parent.Head.face.Texture = "http://www.roblox.com/asset/?id=2886361442"
end
_G.bodyVelocity = true
-- Code to make and place forces into player's body
local force = Instance.new("BodyForce")
force.Parent = Humanoid.Parent:FindFirstChild("HumanoidRootPart")
force.Name = "BodyForce"
local force2 = Instance.new("BodyGyro")
force2.Parent = Humanoid.Parent:FindFirstChild("HumanoidRootPart")
force2.Name = "BodyGyro2"
local force3 = Instance.new("BodyGyro")
force3.Parent = Humanoid.Parent:FindFirstChild("HumanoidRootPart")
force3.Name = "BodyGyro3"
local force4 = Instance.new("BodyGyro")
force4.Parent = Humanoid.Parent:FindFirstChild("HumanoidRootPart")
force4.Name = "BodyGyro4"
local force5 = Instance.new("BodyGyro")
force5.Parent = Humanoid.Parent:FindFirstChild("UpperTorso")
force5.Name = "BodyForce1"
local force6 = Instance.new("BodyGyro")
force6.Parent = Humanoid.Parent:FindFirstChild("UpperTorso")
force6.Name = "BodyGyro2"
local force7 = Instance.new("BodyGyro")
force7.Parent = Humanoid.Parent:FindFirstChild("UpperTorso")
force7.Name = "BodyGyro3"
local ArmForceL= Instance.new("BodyGyro")
ArmForceL.Parent = Humanoid.Parent:FindFirstChild("LeftHand")
ArmForceL.Name = "ArmForceL"
local ArmForceR= Instance.new("BodyGyro")
ArmForceR.Parent = Humanoid.Parent:FindFirstChild("RightHand")
ArmForceR.Name = "ArmForceR"
repeat -- Push player around randomly until they stop falling, then destroy forces
wait(0.1)
local RandomVector = math.random(0,75)
local RandomVector2 = math.random(0,75)
local RandomVector3 = math.random(0,0)
local RandomVector4 = math.random(0,75)
local RandomVector5 = math.random(0,75)
force2.CFrame = CFrame.Angles(math.rad(RandomVector5), math.rad(0), math.rad(0))
force3.CFrame = CFrame.Angles(math.rad(0), math.rad(0), math.rad(RandomVector4))
force4.CFrame = CFrame.Angles(math.rad(0), math.rad(RandomVector), math.rad(0))
force5.CFrame = CFrame.Angles(math.rad(RandomVector5), math.rad(0), math.rad(0))
force6.CFrame = CFrame.Angles(math.rad(0), math.rad(0), math.rad(RandomVector4))
force7.CFrame = CFrame.Angles(math.rad(0), math.rad(RandomVector), math.rad(0))
force2:Destroy()
force3:Destroy()
force4:Destroy()
force5:Destroy()
force6:Destroy()
force7:Destroy()
ArmForceR.CFrame = CFrame.Angles(math.rad(RandomVector), math.rad(RandomVector5), math.rad(RandomVector3))
ArmForceL.CFrame = CFrame.Angles(math.rad(RandomVector2), math.rad(RandomVector4), math.rad(RandomVector3))
wait(0.5)
ArmForceL:Destroy()
ArmForceR:Destroy()
if not _G.AntiGrav then
game.Workspace.Gravity = 50
end
until
_G.PlayerVelocity >= -30 or Humanoid.Parent.HumanoidRootPart:FindFirstChild("BodyForce") == nil
end
end
-- When the player stops falling too fast
if _G.PlayerVelocity >= -65 then
local HumanoidRootPart = Humanoid.Parent:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart then
_G.BodyForce = HumanoidRootPart:FindFirstChild("BodyForce")
end
game.Workspace.SFX.Wind.Playing = false
game.Workspace.SFX.Wind.TimePosition = 0
LandedFOVTween:Play()
FallingFOVTween:Cancel()
_G.Scream.TimePosition = 0
local DamageMultipler = -0.8
if _G.bodyVelocity == true then
_G.bodyVelocity = false
HasCreatedbodyVelocity = false
game.Workspace.Gravity = 75
if _G.BodyForce and Humanoid.Health > 0 then
local Head = Humanoid.Parent:FindFirstChild("Head")
if Head then
local Scream = Humanoid.Parent.Head:FindFirstChild(_G.Scream.Name)
if Scream then
Scream:Destroy()
end
end
if Head then
Humanoid.Parent.Head.face.Texture = PlayerOriginalFace
end
if _G.PlayerIsInSafeZone then -- There are parts around the map that, when touched, sets this global to true
print("Player is in a fall damage free zone.")
Humanoid.Parent.Head.face.Texture = PlayerOriginalFace
elseif _G.CanTakeFallDamage == true then -- Checks if the player has fall damage enabled
if Debounce2 then
Debounce2 = false
local Damage = _G.playerLastSpeed * DamageMultipler -- Calculates how much damage should be done to player
if Damage > 100 then
Humanoid:TakeDamage(100)
elseif Damage < 100 then
Humanoid:TakeDamage(Damage)
end
print(_G.playerLastSpeed * DamageMultipler)
Debounce2 = true
if Debounce3 then
Debounce3 = false
local RandomSlam = math.random(1,3)
print("Players slam is: ".. RandomSlam)
if RandomSlam == 1 then
_G.Slam = game.Workspace.SFX.Slam
elseif RandomSlam == 2 then
_G.Slam = game.Workspace.SFX.Slam2
elseif RandomSlam == 3 then
_G.Slam = game.Workspace.SFX.Slam3
end
_G.Slam:Play()
Debounce3 = true
end
if Humanoid.Health <= 0 then
game.Workspace.SFX.DeathAmbience:Play()
if Head then
Humanoid.Parent.Head.face.Texture = "http://www.roblox.com/asset/?id=5681397588"
end
OverHeadChange:FireServer()
local HasDismembered = false
if _G.playerLastSpeed <= -100 and not HasDismembered then
HasDismembered = true
local RandomAmount = math.random(3,5)
print("Player's random dismemberment is ".. RandomAmount)
for i = 1, RandomAmount do
local RandomPart1 = math.random(1,15)
local RandomPart2 = math.random(1,15)
local RandomPart3 = math.random(1,15)
local RandomTableValue1 = _G.PlayerBodyTable[RandomPart1]
local RandomTableValue2 = _G.PlayerBodyTable[RandomPart2]
local RandomTableValue3 = _G.PlayerBodyTable[RandomPart3]
local TableValueToString1 = tostring(RandomTableValue1)
local TableValueToString2 = tostring(RandomTableValue1)
local TableValueToString3 = tostring(RandomTableValue1)
local RandomSelection1 = Humanoid.Parent:FindFirstChild(TableValueToString1)
local RandomSelection2 = Humanoid.Parent:FindFirstChild(TableValueToString2)
local RandomSelection3 = Humanoid.Parent:FindFirstChild(TableValueToString3)
game.Workspace.SFX.Crack:Play()
if RandomSelection1 then
Dismember:FireServer(RandomSelection1)
end
if RandomSelection2 then
Dismember2:FireServer(RandomSelection2)
end
if RandomSelection3 then
Dismember3:FireServer(RandomSelection3)
end
if _G.playerLastSpeed * 1.7 <= -250 then
local RandomSelection4 = math.random(1,2)
if RandomSelection4 == 1 then
local badgeId = 2127958356
local Selection = "Head"
TerminalVelocity1:FireServer(Selection)
BadgeAward:FireServer(badgeId)
else
local badgeId = 2127958356
local Selection = "LowerTorso"
TerminalVelocity1:FireServer(Selection)
BadgeAward:FireServer(badgeId)
end
end
end
else
print("Player is not going fast enough to splatter.")
end
else
if Head then
Humanoid.Parent.Head.face.Texture = PlayerOriginalFace -- Resets players face
end
end
end
end
end
end
end
end)