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
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?
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