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

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

Asked by 5 years ago
Edited 5 years ago

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

0
Check if the target's name is BlobbyblobBuild_. Use an if statement. DeceptiveCaster 3761 — 5y
0
targets name is BlobbyblobBuild_DiGamesChannel. digameschannel 44 — 5y

2 answers

Log in to vote
0
Answered by
Nowaha 459 Moderation Voter
5 years ago

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?

0
this script shows part name when you look at it. Part name is BlobbyblobBuild_DiGamesChannel. digameschannel 44 — 5y
0
i need it to show DiGamesChannel digameschannel 44 — 5y
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" digameschannel 44 — 5y
0
script.Parent.Text = script.Parent.Text:gsub("BlobbyblobBuild_", "")); should do the trick Nowaha 459 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
  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

Answer this question