Hello Developers!
Does anyone know what is wrong with this script? What happens so far is only the text gets to “Hello” but you can’t make it say the text after. Also, “Hello” is a bit delayed.
(Just find where I set ‘TalkText’ because that is the only bit that isn’t working
Any ideas?
local Distance = 10
local talking = false
local players = game:GetService("Players")
local player = players.LocalPlayer
local startergui = game:GetService("StarterGui")
local screengui = startergui.ScreenGui
local frame = screengui.Frame
local nf = frame.NextFrame
local nb = nf.NextButton
nf.Visible = false
nb.Visible = false
frame.Position = UDim2.new(0, 0,1.2, 0)
local talkable = true
local touching = false
while wait()do
for i,v in pairs(workspace:GetChildren()) do
if game.Players:FindFirstChild(v.Name) then
if(v.PrimaryPart.Position - script.Parent.Position).magnitude <= Distance then
if talking == false then
touching = true
local character = v
local player = players:GetPlayerFromCharacter(character)
local playerGui = player:WaitForChild("PlayerGui")
local screenGui = playerGui:WaitForChild("ScreenGui")
local frame = screenGui:WaitForChild("Frame")
local tb = frame:WaitForChild("TalkButton")
frame:TweenPosition(UDim2.new(0, 0,0.73, 0), "Out", "Back")
local nextframe = frame:WaitForChild("NextFrame")
local nextbutton = nextframe:WaitForChild("NextButton")
if talkable == true then
if touching == true then
tb.MouseButton1Click:Connect(function()
local talktext = frame:FindFirstChild("TalkText")
talktext.Text = ""
nextbutton.Visible = true
nextframe.Visible = true
tb.Visible = false
talktext.Visible = true
wait(0.5)
talktext.Text = "Hello!"
nb.MouseButton1Click:Connect(function()
talktext.Text = "I'm Colour. The one and only!"
nb.MouseButton1Click:Connect(function()
talktext.Text = "And your name is..."
nb.MouseButton1Click:Connect(function()
talktext.Text = v.Name .. "?"
nb.MouseButton1Click:Connect(function()
talktext.Text = "Am I pronouncing that right?"
end)
end)
end)
end)
end)
end
end
end
else
if talking == false then
touching = false
local character = v
local player = players:GetPlayerFromCharacter(character)
local playerGui = player:WaitForChild("PlayerGui")
local screenGui = playerGui:WaitForChild("ScreenGui")
local frame = screenGui:WaitForChild("Frame")
local tb = frame:WaitForChild("TalkButton")
local nextframe = frame:WaitForChild("NextFrame")
local nextbutton = nextframe:WaitForChild("NextButton")
local talktext = frame:FindFirstChild("TalkText")
talktext.Text = ""
frame:TweenPosition(UDim2.new(0, 0,1.2, 0), "Out", "Back")
end
end
end
end
end