Is there a way to detect hit on server-side part with local Touched-Event?

Is there a way to detect server-side part with a local Touched-Event? I need to run it on client to remove the delay or else my code just dont work at all.

It only detect the client player-character.

This is a repost but more concret about what i asked in a previous topic when i did not really understand the problem well.

--local ReplicatedStorage = game:GetService("ReplicatedStorage")
--local TouchedEvent = ReplicatedStorage.LocalTouched
local Part = workspace.TouchPartTest

Part.Touched:Connect(function(Hit)
	TouchedEvent:FireServer(Part, Hit)
	print(Hit)
end)

I believe you can. Put your Touched event inside of a LocalScript and there you go. Althought I wouldn’t recommend it as it could be exploited. You could use a Region aswell.

(Feel free to mark this a solution if it helped )

No you dont understand, what i did right now only detect if the part was touched only by the local player character or your player character but i want it to detect server-side part or just simply something else than your player character.

1 Like

Ah I see what your talking about, to answer your question you can.

Heres a script I use to see if something touches a part


local part = script.Parent
 
 
 
part.Touched:Connect(function(touch)
    
    
    
    
    debounce = true
    
    
    local char = touch.Parent
    
    local plr = game.Players:GetPlayerFromCharacter(char)
        
        
   print("omg somethings touching me >;(")
 
    
    
end)

Is this what you mean? This is a normal script in a part that prints if something went inside it. You could filter out if the object thats touching has a humanoid to see if it was a human or not.

    if not touch.Parent:FindFirstChild("Humanoid") then return end

Client side code is meant for dealing with client sided “Things” and “Operations”. You could for example make clones of nonreplicated objects from the server onto the client and then track and update their properties; however, this is a bit overkill.

Maybe explaining your reasoning for not using the event/function within a server sided script could be helpful.

1 Like

Well tbh its good to lessen the controllability on the client, however when push comes to shove you can have it do the minor things.

1 Like

So because of the delay with the event if you do it on the server it totaly break my game even with like 3ms it break because the part has time to bounce off when it got touched for real and then when the part and hit part are not touching one another the event code run and it return an error saying that im trying to reference nil or for you to understand, my SubtractAsync() which create air or nothing because both part are again, not touching one another. So that why i want to use client cause in a bug report they said and used the client and the server to get the delay which if you want to get a delay between something your firstly need the non-delayed time so yeah.