Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why wont my talk script work?

Asked by 9 years ago
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

Log in to vote
1
Answered by 9 years ago

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

0
BTW, I recommend you to replace s*** with #### (The roblox way), so you don't get banned RandomCraftER2002 0 — 9y
Ad

Answer this question