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

IS it real to erase a part of text in text label?

I tried some ways to erase selected part of a text but it didn't worked. Look at the script:

1  while wait() do
2     if mouse.Target ~= nil and mouse.Target.Locked == false then
3         script.Parent.Text = "Hovering- ".. mouse.Target.Name .."'s Parts"
4 	script.Parent.Text(string.gsub("BlobbyblobBuild_"))
5    end
6 end

idk what i did wrong. but it always gives nil at line 4. can someone help me?

in text label it must give something like this - hovering- DiGamesChannel's Parts but it gives hovering- BlobbyblobBuild_DiGamesChannel's Parts

2 comments

0

Check if the target's name is BlobbyblobBuild_. Use an if statement.

0

targets name is BlobbyblobBuild_DiGamesChannel.

2 answers

✓ Accepted answer

Nothing on line 4 is correct.

First of all, to set the text of something, you have to do .Text =, not .Text().

So, when changing that we get: script.Parent.Text = string.gsub("BlobbyblobBuild_")

This, however, is still wrong if you searched up how to USE gsub.

I hope that information will help you. If it doesn't, please reply with what you're trying to replace and why. I have no idea what you're trying to do.

Based on your description, you want Hovering- DiGamesChannel's Parts, correct? Then why do you have line 4? You can just remove line 4 and you have what you're trying to get?

4 comments

0

this script shows part name when you look at it. Part name is BlobbyblobBuild_DiGamesChannel.

0

i need it to show DiGamesChannel

0

The script works like this - If you aim at someones part it shows owner of part by copying name of part into the text label. "Hovering- BlobbyblobBuild_Fuddelys's Part" i need it to erase "blobbyblobbuild_" part so it will show "Hovering- Fuddelys's Part"

0

script.Parent.Text = script.Parent.Text:gsub("BlobbyblobBuild_", "")); should do the trick

  while wait() do
     if mouse.Target--[[checks if there is a valid target, no need to use ~=]] and mouse.Target.Locked == false then
         script.Parent.Text = "Hovering- ".. mouse.Target.Name .."'s Parts"
   script.Parent.Text(string.gsub("BlobbyblobBuild_"))--i dont fuloly understand gsub yet sadly
    end
 end

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