I've made a script and it is supposed to CFrame a part to a Player's torso(yes he part does have CanCollide off), but for whatever reason as soon as I set a touch function the part goes above the Player's head as if CanCollide is on.Is there anyway to get around this or is it just my code?

local BE = game:GetService("ReplicatedStorage").Jobs.Blind
local TweenService = game:GetService("TweenService")
local function Touched(Hit)
	if Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid") then
		local x = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
		local Found = game:GetService("Players").GetPlayerFromCharacter(x)
		print(Found.Name)
		local Gui = Instance.new("ScreenGui")
		local Frame = Instance.new("Frame")
		Frame.BackgroundColor3 = Color3.fromRGB(255,255,255)
		Frame.Size = UDim2.new(1,0,1,0)
		Frame.Parent = Gui
		Gui.Parent = Found.PlayerGui
		game:GetService("Debris"):AddItem(Gui,5)
	end
end


BE.OnServerEvent:Connect(function(Player)
	local Ball = Instance.new("Part")
	Ball.Color = Color3.fromRGB(255,255,255)
	Ball.Material = "Neon"
	Ball.Anchored = true
	Ball.Shape = "Ball"
	Ball.CanCollide = false
	Ball.CFrame = Player.Character.Torso.CFrame
	
	local Goal = {}
	Goal.Size = Vector3.new(60.81, 60.81, 60.81)
	
	Ball.Parent = Player.Character
	Player.Character.Torso.Anchored = true
	
	local Info = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 3, true)		
	local Tween = TweenService:Create(Ball, Info, Goal)
		
	Ball.Touched:Connect(Touched)		
	
	Tween:Play()
	
	wait(3)
	Player.Character.Torso.Anchored = false
	Ball:Destroy()

Before Touched function

After

6 comments

0

You cannot simply make the torso non-collidable.

0

I meant the part...............

0

That is strange... I don't suppose running a for loop to check player distances is possible instead of this?

0

I wonder if you've found a bug! Regardless, a fix might be to listen to a RenderStepped/Heartbeat event and to re-CFrame the sphere back where you want it (and then disconnect the event when the Tween is finished)

0

I don't think there is a reason to do a disconnect , since it automatically disconnects the function when i destroy the Part.

0

I've gotten no luck with the Heart beat but thanks for trying to help me.