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

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

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

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)

13 comments

0

how do i import that textbox into playergui?

0

Just put it in the startergui

0

referring to the edit, i have done that

0

sorry for being such a pain

0

Whoops I messed up

0

Is your game Filtering Enabled?

0

Ohh lemme fix this then

0

im so sorry but im like, confused, client, server? (this is a singleplayer game)

0

Wait Wait. Singleplayer? Turn off Filtering Enabled if it's single player.

0

0.0 SO FREAKING SORRY

0

OOH thanks buddy :D

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