Is it possible to make a player on a specific team called (FBI) makes a sound whenever he is close to another player in another team called (L.E.D)?
yes it’s possible but you have to define what is “close” (5 studs, 10 studs, 100 studs? etc)
2 Likes
Okay, I think 5 studs is great.
You can use magnitude to check if they’re nearby one another, if they’re, play the sound as intended or whatever you’d like it to do:
1 Like
you put the sound into the starter GUI and then when the magnitude is 5 or lower you play the sound with :Play()
hope this helps…took some time
function findNearestTorso(pos)
local Players = game:GetService("Players")
local plr = Players.LocalPlayer
local list = game.Workspace:children()
local torso = nil
local hp = plr.HumanoidRootPart: findNearestTorso(pos)
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if hp.Magnitude <plr.hp.Magnitude
and (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < hp then
if plr.Team=="Fbi"
then plr.FbiNoise:Play()--keep fbi sound in another script
--keep that anywhere and type script.fbisound.Parent=game.Players.LocalPlayer
--but make sure a sound called fbisound is child of that script,the one you just typed
--do whatever the documentation says and delete the green part from this script
--delete all parts documented i.e --blah bla
end
Ah, thanks but, where do I put this script?
local script in starter player scripts, or normal one in server script service, also type in the other script i’ve written about