Good day! So, I made a script that what happens is, when the "Player" in Workspace, in studio, touches a brick, the NPC OPG goes to him and chases him until he touches the red brick. So, now that I know this works with just the Player model when testing, I am trying to get it in multiplayer online. I am having trouble getting the certain players name that touches the brick, then the NPC goes to that certain player. I know to you GetChildren in Players, but I have no idea what to do after that, any help?
LW = game.Workspace.zone.LW
Mid = game.Workspace.zone.Mid
OPG = game.Workspace.zone.OPG
RW = game.Workspace.zone.RW
z1 = game.Workspace.zone.Zones.z1
z2 = game.Workspace.zone.Zones.z2
z3 = game.Workspace.zone.Zones.z3
z4 = game.Workspace.zone.Zones.z4
opg1 = false
lw1 = false
mid1 = false
rw1 = false
z5 = game.Workspace.zone.Zones.z5
v = game.Players:GetPlayers()
f = game.Players:GetFullName()
LeftArm = game.Workspace.zone.OPG["Left Arm"]
LeftLeg = game.Workspace.zone.OPG["Left Leg"]
RightArm = game.Workspace.zone.OPG["Right Arm"]
RightLeg = game.Workspace.zone.OPG["Right Leg"]
Head = game.Workspace.zone.OPG.Head
HumanoidRootPart = game.Workspace.zone.OPG.HumanoidRootPart
Torso = game.Workspace.zone.OPG.Torso
game.Players.PlayerAdded:connect(function()
local plr = game.Players:GetPlayers()
local f= game.Players:GetChildren()
for i = 1, #f do
print(f[i])
end
end)
z1.Touched:connect(function(hit,plrtouched)
local hum = hit.Parent:FindFirstChild("Humanoid")
local opg = hit.Parent:FindFirstChild("OPG")
if opg1 == false and hit.Parent:FindFirstChild("Basketball") then
opg1 = true
print("Found Player")
local plr = game.Players:GetPlayers()
local f= game.Players:GetChildren()
while opg1 == true do
wait(0.9)
OPG.Humanoid.WalkToPoint = game.Workspace.plrtouched.Basketball.Position - Vector3.new(5,0,3)
end
else
print("Did not find player")
end
end)
z5.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if opg1 == true and hum then
opg1 = false
z1.Parent = game.Lighting
OPG.Humanoid.WalkToPoint = Vector3.new(-1.344, 13.419, -26.512)
wait(5)
z1.Parent = game.Workspace.zone.Zones
else
return false
end
end)

2 comments
try using the moveTo function opposed WalktoPoint
That isn't my question. ;/