Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont my talk script work?

local sp = script.Parent

button = sp
player = game.Players.LocalPlayer

msg = player.StarterGui.TextBox.TextLabel

msg.Visible=false

function Talk()
		player.Torso.Anchored=false
		msg.Visible=true
		wait(3)
		msg.Text="Logan: Nice to see you again."
		wait(3)
		msg.Text"Mr.Clark: We have bad news."
		wait(2)
		msg.Text="Mr.Clark: Even though you just came out of the military..."
		wait(5)
		msg.Text="Mr.Clark: You are joining back."
		wait(3)
		msg.Text="Logan: Bu-but, why?"
		wait(3)
		msg.Text="Mr.Clark: A year ago, Captain.Mackintosh was kidnapped by the enemies."
		wait(4)
		msg.Text="Mr.Clark: We just found out now currently in 2014"
		wait(3)
		msg.Text="Logan: Oh s***!!, is he alright!?!"
		wait(3.1)
		msg.Text="Mr.Clark: We are not sure"
		wait(4)
		msg.Visible=false
	end


function Touch(button)
		if player:Touch(button) then
			Talk()
		end
end

sp.Touched:connect(Touch)

No output, but It just wont work. Why?

1 answer

It's playerGui not starterGui. Also, you are supposed to put these in a screen GUI. new structure:

-- PlayerGui
----ScreenGui
------Button
--------LocalScript(Below)
------TextBox
--------TextLabel

local sp = script.Parent

button = sp
player = game.Players.LocalPlayer

msg = player.PlayerGui.ScreenGui.TextBox.TextLabel

msg.Visible=false

function Talk()
        player.Character.Torso.Anchored=false
        msg.Visible=true
        wait(3)
        msg.Text="Logan: Nice to see you again."
        wait(3)
        msg.Text="Mr.Clark: We have bad news."
        wait(2)
        msg.Text="Mr.Clark: Even though you just came out of the military..."
        wait(5)
        msg.Text="Mr.Clark: You are joining back."
        wait(3)
        msg.Text="Logan: Bu-but, why?"
        wait(3)
        msg.Text="Mr.Clark: A year ago, Captain.Mackintosh was kidnapped by the enemies."
        wait(4)
        msg.Text="Mr.Clark: We just found out now currently in 2014"
        wait(3)
        msg.Text="Logan: Oh s***!!, is he alright!?!"
        wait(3.1)
        msg.Text="Mr.Clark: We are not sure"
        wait(4)
        msg.Visible=false
    end

sp.MouseButton1Click:connect(function(button)
            Talk()
end)

I've Tested it Again

1 comment

0

BTW, I recommend you to replace s*** with #### (The roblox way), so you don't get banned

This discussion is preserved as it was. New answers, comments, and votes are closed.