For the first one you do something as simple as:
local ply = game.Players.LocalPlayer
local key = ""
local door = game.Workspace.Door
ply.Chatted:connect(function(msg,rcp)
if msg == key and door.CanCollide then
door.CanCollide = false
end
end)
Don't know who or what that is so I'm gonna assume from your description that it's a chase on sight npc:
local ply = game.Players.LocalPlayer
local cam = game.Workspace.CurrentCamera
local npc = game.Workspace.Npc
local runService = game:GetService("RunService")
local function isLooking()
local val = npc:FindFirstChild("Target").Value
if not val or val and not val.Parent then
local pos = cam:WorldToScreenPoint(npc.PrimaryPart.Position)
local maxDistance = 100
local distance = (npc.PrimaryPart.Position-ply.Character.PrimaryPart.Position).magnitude
if distance <= maxDistance and pos.Z > -1 then
npc:FindFirstChild("Target").Value = ply.Character
end
end
end
runService:BindToRenderStep("isLooking",0,search())
Put this in a script under the Npc:
local target = script.Parent:FindFirstChild("Target")
target.Changed:connect(function(val)
end)
No clue how any of this performs on a server or has any errors, but hope it helps.
8 comments
Not a request site!
Not requesting. I have no idea how to script it, so i am asking how i would do it.
You ARE requesting. You’re asking for someone to make the code for you.
Uhm? no? Im asking if anyone knows how to do it, as in HELP me make it.
Also whats your issue. is it cause im a noob? I came to this website to help me script what i needed. Not to be annoyed.
Well, help would be you have ALREADY attempted it, but it doesn’t work.
Ive been trying for a while now. I just can get it right, which is why i have signed up for this sight. I would'nt be here if there was a tutorial.
You need to attempt it on your own then post what script you have tried. Then you can ask for help. Not before. We will not spoon feed you the answer. This is a scripting helpers website. Not a we write the code for you website. We will take what you have tried and help you with it. Please try to post better questions in the future.