CC Project Associates: @Immites @Scarital
Hi all, I usually would not need to make such a post, however this bug has plagued me for days and is now slowing down the speed of development on an important project.
To put it simply, I have a script which flings players using a LinearVelocity object. This script works perfectly fine when the player stays alive during use, however, when they die, all interactions with this LinearVelocity instantly cease and the player drops to the floor. This is not the intended behaviour, and I have no clue why it has begun occurring.
So far I have tried editing many of the scripts in my game, such as a rag doll system (e.g. checking humanoid states), the fling system (updating from BodyVelocity to LinearVelocity), and the invocation of the functions. None of these solutions have worked. I will attach various code snippets below which are used throughout the project. If any more content is required then please let me know and I’d be happy to attach them.
LOCALSCRIPT FLING
function onPlayerFlingClientEvent(Part, Point, Power, Stun, SetVelocity)
local Attachment = Instance.new("Attachment")
Attachment.Name = "TEMP"
Attachment.Parent = Part
local linearVelocity = script.LinearVelocity:Clone()
linearVelocity.Parent = Attachment
linearVelocity.Attachment0 = Attachment
linearVelocity.Enabled = true
if SetVelocity then
linearVelocity.VectorVelocity = Point;
else
linearVelocity.VectorVelocity = (Part.Position - Point).Unit * Power;
end
Debris:AddItem(Attachment, 0.15)
end
INVOCATION OF FLING SCRIPT
shared.FlingPlayer:Fire(Victim, Character.HumanoidRootPart, Vector3.new(0, 25, 0) + (HitPlayerPos - CasterPlayerPos).Unit * 75, -120, true, true, Caster)
CLIENT-SERVER COMMUNICATION
shared.FlingPlayer.Event:Connect(function(who, part, point, power, stun, setVel, casterPlayer, sp)
if typeof(who) == 'table' then
FlingItem(who.Character, part, point, power, stun, setVel);
elseif who:IsA("Player") then
if who == casterPlayer then
if sp == "trip" then
ClientFling:FireClient(who, part, (who.Character.HumanoidRootPart.Position - (who.Character.HumanoidRootPart.Position + who.Character.HumanoidRootPart.CFrame.lookVector * 10)).Unit * 10, power, stun, setVel);
else
ClientFling:FireClient(who, part, Vector3.new(0, 25, 0) + (who.Character.HumanoidRootPart.Position - (who.Character.HumanoidRootPart.Position + who.Character.HumanoidRootPart.CFrame.lookVector * 20)).Unit * 75, power, stun, setVel);
end
else
ClientFling:FireClient(who, part, point, power, stun, setVel);
end
end
end)