function TimeToAsk(player, mousePos, originPos)
print("It was " .. player.Name)
local direction = (mousePos - originPos).Unit * AskingRange
local result = workspace:Raycast(originPos, direction, rcParams)
print(result)
if result then
if result.Instance.Parent:FindFirstChild("Humanoid") then
local NpcID = result.Instance.Parent
print(NpcID.Name .. " was asked")
print(result.Instance.Name .. " was hit")
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
Greetings:FireServer(NpcID, false)
game.StarterGui: SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
else
NobodyWasFound()
end
else
NobodyWasFound()
end
end
i see, ur local script is actually sending the npc itself in the first place, seems fine, the problem is in ur script,
local function onRemoteTriggered(player, npcID, gunActive)
print(player.Name .. "'s signal was received, now triggering script for " .. npcID.Name)
local npc = game.Workspace:FindFirstChild(npcID.Name)
if npc and NPCManager.NPCs[npcID.Name] then
print("Script running!")
print(player)
print(npc)
NPCManager.NPCs[npcID.Name](player, npc, gunActive)
end
end
should be
local function onRemoteTriggered(player, npcID, gunActive)
print(player.Name .. "'s signal was received, now triggering script for " .. npcID.Name)
local npc = game.Workspace:FindFirstChild(npcID.Name)
if npc and NPCManager.NPCs[npcID.Name] then
print("Script running!")
print(player)
print(npc)
NPCManager.NPCs[npcID.Name](player, npcID, gunActive)
end
end
the
NPCManager.NPCs[npcID.Name](player, npcID, gunActive)
now sends the npc sent by the client, not the npc the server found in workspace (which have the same id but different npc)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.