Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local npc = workspace:WaitForChild("NPC")
- local inputted = script.Inputted.Value
- local uis = game:GetService("UserInputService")
- local text = "Would you like extra walk speed?"
- local length = string.len(text)
- while wait() do
- local magnitude = (npc.HumanoidRootPart.Position - player.Character.HumanoidRootPart.Position).Magnitude
- if magnitude < 15 then
- script.Parent.Visible = true
- script.Parent.E.MouseButton1Click:Connect(function()
- if inputted == true then
- inputted = false
- script.Parent.Parent.Parent.TalkGui.TalkFrame.Dialogue.Text = ""
- script.Parent.Parent.Parent.TalkGui.TalkFrame.Visible = true
- for i = 1, length do
- script.Parent.Parent.Parent.TalkGui.TalkFrame.Dialogue.Text = text:sub(1, i)
- wait(0.04)
- end
- end
- end)
- uis.InputBegan:Connect(function(input, processed)
- if input.UserInputType == Enum.UserInputType.Keyboard and inputted == true and input.KeyCode == Enum.KeyCode.E and not processed then
- inputted = false
- script.Parent.Parent.Parent.TalkGui.TalkFrame.Dialogue.Text = ""
- script.Parent.Parent.Parent.TalkGui.TalkFrame.Visible = true
- for i = 1,length do
- script.Parent.Parent.Parent.TalkGui.TalkFrame.Dialogue.Text = text:sub(1, i)
- wait(0.04)
- end
- end
- end)
- else
- script.Parent.Visible = false
- script.Parent.Parent.Parent.TalkGui.TalkFrame.Visible = false
- end
- if script.Parent.Parent.Parent.TalkGui.TalkFrame.Visible == false then
- inputted = true
- end
- end
Add Comment
Please, Sign In to add comment