Pretty sure you could do
script.Parent.Touched:connect(function)
I think this is what you’re going for:
local part = script.Parent
local playersService = game:GetService("Players")
part.Touched:Connect(function(partTouched)
if partTouched.Parent:FindFirstChild("Humanoid") then
if playersService:GetPlayerFromCharacter(partTouched.Parent) then
-- when the part is touched script here
end
end
end)
If I was you I’d probably add a debounce (cool down) in order to reduce the load of this thread as touching the part would cause this function to run at a very high rate. (I can help with too if you want)
Ye could i have further support im quite new to scripting. Ill just have a think ill be 10 mins then let you know.
hello, im back so do i put this in server script service?
where is the part where i changed it to the part name that i have
Yes, a server script. A local script will not be able to change the values for the server.
So i put it in server script service. Which bit do i change to make it apply to the name of my part. Or do i add another script.