Any idea why it's not detecting .Touched?

Hello! So my system, removes the model, and places a part in the CFrame of model.HitPart, it’s just speed radars, so, basically, if you touch it at more than >= 60 speed then… you get notification, but it’s not printing ‘touched’ as it should, on .Touched function, this is how it looks when I run game on clientside
image
this is how it looks when i’m not running game at serverside or runing game tho, because it’s clientsided.
image
You might ask… uhm… why did you made this? if you can do the same, but check if .Touched was on hitpart?
Because, if other player touches it, the local player get’s bounty tho, as all in game, so if I make it clientsided, then, it’s going to work for the certain player!

function GiveFunction(v)
	local yee = v
	v = v.HitPart
	local newpart = Instance.new("Part", workspace.SpeedRadars)
	newpart.Position = v.Position
	newpart.Size = v.Size
	newpart.Orientation = v.Orientation
	newpart.CFrame = v.CFrame
	newpart.Anchored = true
	newpart.Name = v.Parent.MaxSpeed.Value
	newpart.CanCollide = false
	newpart.Transparency = 1
	yee:Destroy()

    newpart.Touched:Connect(function(Hit)
	print('touched')
        if Character:WaitForChild("Humanoid").Sit == true  and not debounce and Player.Team == game.Teams["Civilian Operations"] then
    
        local Speed = math.ceil(Hit.Velocity.Magnitude/2)
        if Speed >= tonumber(newpart.Name) then
	print("Ok")
		Notifications.CreateNotification("+"..tostring(math.ceil(Speed/2)).." bounty for speeding.", 6)
	game.ReplicatedStorage.GiveBounty:FireServer(math.ceil(Speed/2))
	debounce = true

            end
wait(0.4)
debounce = false
            
   end
        end)
	
end



for i,v in ipairs(workspace.SpeedRadars:GetChildren()) do
    if v and v:IsA("Model") then
        GiveFunction(v)
    end
end

No errors.

Why are you checking if the player is sitting?

Anchored parts do not register .Touched events since they do not make use of physics. Since CanCollide is false, you could make use of a BodyPosition to position the part, so that it seems like it’s anchored. You could do something like this:

local bodyPos = Instance.new("BodyPosition")
bodyPos.Parent = newpart
bodyPos.Position = v.Position

to get the same results.

1 Like

What do you mean? Anchored parts do not register .Touched? If I used this event on a lot of anchored parts…?

I fixed, it, anchoring parts worked, I setted CFrame, and looks like that worked

My apologies, I’m thinking of two anchored parts. Great that you found the solution.

Yes, I removed my solution, because it was kind of derp to giving yourself solution, anyway, thank you!!

1 Like