Having a problem where when I weld this part to the player, the player suspends from the ground. Of course, they fall back down but I don’t want this to happen and it can be abused in my context. Any suggestions would be appreciated.
Here is my code:
local function showKillzone(target)
if target.Parent:FindFirstChild("Humanoid") then
if selectedTarget == target.Parent then return end
if selectedTarget then
removeSelected()
end
local player = Players:GetPlayerFromCharacter(target.Parent)
if not player then return end
print(player.Name)
--[[local rankInGroup = player:GetRankInGroup(groupID)
local studSize = getKillzoneStudSize(rankInGroup)
if not studSize then return end
print(studSize)--]]
local char = target.Parent
local weld = Instance.new("Weld")
local HRP = char:FindFirstChild("HumanoidRootPart")
if not HRP then return end
local clone = Parts.Killzone:Clone()
clone.CanCollide = false
clone.Parent = char
--clone.Size = Vector3.new(studSize, killzoneThickness, studSize)
clone.Size = Vector3.new(7, killzoneThickness, 7)
clone.CFrame = HRP.CFrame
weld.Part0 = clone
weld.Part1 = HRP
weld.C0 = clone.CFrame
weld.C1 = HRP.CFrame * CFrame.new(0, -2.75, 0)
weld.Parent = HRP
selectedTarget = target.Parent
else
if selectedTarget and workspace:FindFirstChild(selectedTarget.Name) then
removeSelected()
end
end
end