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

How to edit a textbox text when script is outside of the textbox? [SOLVED]

Asked by 7 years ago
Edited 7 years ago

well, I wanted it to be when you collect a "star" the box would say A STAR?! here is the script

local brick = script.Parent

function onTouched(hit)

    for i,player in ipairs(game.Players:GetPlayers()) do

        if player.Character then

            local stat = player:FindFirstChild("leaderstats")

            if stat then

                game.SoundService.Sound:Play()

                player.leaderstats.Bonuses.Value = player.leaderstats.Bonuses.Value +1
                player.leaderstats.TotalBonuses.Value = player.leaderstats.TotalBonuses.Value +1
                game.StarterGui.textbox.text = ("A STAR?!") --the problem is that when i was typing textbox i could not use TAB to finish the word textbox thing. same with text

                brick:Destroy()


            end

        end

    end

end

brick.Touched:connect(onTouched)

1 answer

Log in to vote
0
Answered by
Griffi0n 315 Moderation Voter
7 years ago
Edited 7 years ago

What you need to do is put ScreenGui in the StarterGui and put the TextBox in it.

local remote = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage"))
remote.Name = "Star"

script.Parent.Touched:connect(function(part)
    local player = game.Players:GetPlayerFromCharacter(part.Parent)
    if player then
            player.leaderstats.Bonuses.Value = player.leaderstats.Bonuses.Value + 1
            player.leaderstats.TotalBonuses.Value = player.leaderstats.TotalBonuses.Value + 1
        local sound = game.SoundService.Sound:Clone()
        sound.Parent = player.PlayerGui
        sound.Playing = true
        player.PlayerGui.ScreenGui.textbox.Text = text
            brick:Remove()
    end
end)
0
how do i import that textbox into playergui? Skysenbajsen 0 — 7y
0
Just put it in the startergui Griffi0n 315 — 7y
0
referring to the edit, i have done that Skysenbajsen 0 — 7y
View all comments (9 more)
0
sorry for being such a pain Skysenbajsen 0 — 7y
0
Whoops I messed up Griffi0n 315 — 7y
0
Is your game Filtering Enabled? Griffi0n 315 — 7y
0
Ohh lemme fix this then Griffi0n 315 — 7y
0
im so sorry but im like, confused, client, server? (this is a singleplayer game) Skysenbajsen 0 — 7y
0
Wait Wait. Singleplayer? Turn off Filtering Enabled if it's single player. Griffi0n 315 — 7y
0
0.0 SO FREAKING SORRY Skysenbajsen 0 — 7y
0
OOH thanks buddy :D Skysenbajsen 0 — 7y
Ad

Answer this question