-- Local script in starterpack
local debounce = false
local name = "Dave"
local message = "Hey man, what's up?"
local dist = 7
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local interact = game.ReplicatedStorage.Interact
while true do
for i, npc in pairs(workspace.NPCs:GetChildren()) do
if (char:WaitForChild("HumanoidRootPart").CFrame.p - npc.HumanoidRootPart.CFrame.p).magnitude <= dist then
game.ReplicatedStorage.Remotes.StartDialog:FireServer(name, message, npc, dist)
end
end
wait(1)
end
-- Script inside serverscriptservice
local uis = game:GetService("UserInputService")
local debounce = false
local interact = game.ReplicatedStorage.Interact
local dialog = game.ServerStorage.Dialog
game.ReplicatedStorage.Remotes.StartDialog.OnServerEvent:Connect(function(player, name, message, npc, dist)
local playerGui = player:WaitForChild("PlayerGui")
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
if (char:WaitForChild("HumanoidRootPart").CFrame.p - npc.HumanoidRootPart.CFrame.p).magnitude <= dist then
interact.Parent = playerGui
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E and not debounce and interact.Parent == playerGui then
debounce = true
print("pressed e")
dialog.Parent = playerGui
hum.WalkSpeed = 0
hum.JumpPower = 0
wait(1)
debounce = false
end
end)
else
interact.Parent = game.ReplicatedStorage
end
end)
This is my dialog system. The interact gui appears when needed, but the dialog gui doesn't appear when I press e. What can I do to fix this?

4 comments
BRUH... didn't you read what I said above? -.- the "UserInputService" ain't gonna work inside a script it needs to be in a LOCAL SCRIPT!
oh, i might can help ya
but there was a problem in this script
now i made an another script, with your problem fixes