Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does roblox's collision system go off with the Touched function?

Asked by
farrizbb 465 Moderation Voter
7 years ago
Edited 7 years ago

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?

01local BE = game:GetService("ReplicatedStorage").Jobs.Blind
02local TweenService = game:GetService("TweenService")
03local function Touched(Hit)
04    if Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid") then
05        local x = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
06        local Found = game:GetService("Players").GetPlayerFromCharacter(x)
07        print(Found.Name)
08        local Gui = Instance.new("ScreenGui")
09        local Frame = Instance.new("Frame")
10        Frame.BackgroundColor3 = Color3.fromRGB(255,255,255)
11        Frame.Size = UDim2.new(1,0,1,0)
12        Frame.Parent = Gui
13        Gui.Parent = Found.PlayerGui
14        game:GetService("Debris"):AddItem(Gui,5)
15    end
View all 43 lines...

Before Touched function

After

0
You cannot simply make the torso non-collidable. hiimgoodpack 2009 — 7y
0
I meant the part............... farrizbb 465 — 7y
0
That is strange... I don't suppose running a for loop to check player distances is possible instead of this? whenallthepigsfly 541 — 7y
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) chess123mate 5873 — 7y
View all comments (2 more)
0
I don't think there is a reason to do a disconnect , since it automatically disconnects the function when i destroy the Part. farrizbb 465 — 7y
0
I've gotten no luck with the Heart beat but thanks for trying to help me. farrizbb 465 — 7y

Answer this question