Hello I want to make a script that detects a player when it’s touching a block, but I think touch funtion is not a good way cause it can be fires only when a player jump or walk, but if it’s not doing anything of these actions, the script doesn’t detect it, so how can I do ?
try using workspace:GetPartsInPart(Part)
but I can’t use GetPartsInPart with a single Part, and also I’ve never used GetPartsInPart cause I’m a new dev…
wdym by you can’t?
there also Region3, check it too
okay I’ve make this but it doesn’t work…
RemoteEvent.OnServerEvent:Connect(function(x, argument)
local TouchingParts = TouchPart:GetTouchingParts()
for i=1, #TouchingParts do
if TouchingParts[i].Name == "HumanoidRootPart" then
TouchingParts[i].CFrame = CFrame.new(Area.Position)
end
end
wait(1)
--x.Character:FindFirstChild("HumanoidRootPart", 1).CFrame = CFrame.new(Area.Position)
end)
replace with
for i, part in pairs(TouchPart:GetTouchingParts()) do
if part.Name == "HumanoidRootPart" then
part.CFrame = InvisiblePart.CFrame -- also look here
end
end
okay I tried this but it doesn’t teleport me…
while wait(3) do
for i, part in pairs(TouchPart:GetTouchingParts()) do
if part.Name == "HumanoidRootPart" then
print("found")
part.CFrame = Area.CFrame
end
end
wait()
end
Add this code
while wait(3) do
for i, part in pairs(TouchPart:GetTouchingParts()) do
if part.Name == "HumanoidRootPart" then
print("found")
part.Parent:MoveTo(Area.Position)
end
end
wait()
end