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

Please Sword Help?

Sword Help?

local Texture = GuiBar.Text
local SwordMesh = script.Parent
pcall(function()
SwordMesh.TextureId = "http://www.roblox.com/asset/?id=" .. Texture
end)

For this script, I want it upgraded, so I want it to change Not everyone's sword just the user who types in a decal ID, into a GUI chatbar. And once they press enter, the script inserts the mesh's TextureID, to the one they typed in. Could someone help me with that?

3 answers

local player = Game.Players.LocalPlayer
local swordMesh = script.Parent
local GuiBar = player.PlayerGui.Example.TextBox --Change to correct path.
GuiBar.FocusLost:connect(function() --When someone is finished typing into the TextBox,
    pcall(function() 
        swordMesh.TextureId = "http://www.roblox.com/asset/?id="..tostring(tonumber(GuiBar.Text)-1) --Try to change the texture.
    end)
end)

1 comment

0

This must be a LocalScript.

Add a KeyDown event for enter and get the .Text of the textbox you want to use to get the decal id. This is really simple...

By the way, "Data Persistence" doesn't go with this.

2 comments

0

If this is not what you are asking for then clarify please.

0

I put it as that, because I'm trying to make a script that saves when you do this, so you can name your sword.

Lem0n, your problem is that you didn't even connect the function. Put in a connector line and the above script should run smoothly.

3 comments

0

That's not what I was asking for...

0

Did you really have to vote me down? Legit.

0

He didn't vote you down (currently), and it's part of the way the community is to handle bad answers/questions.

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