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

Please Sword Help?

Asked by 10 years ago

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

Log in to vote
1
Answered by 10 years ago
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)
0
This must be a LocalScript. Articulating 1335 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

Add aKeyDown 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.

0
If this is not what you are asking for then clarify please. PiggyJingles 358 — 10y
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. Lem0nzz 5 — 10y
Log in to vote
-2
Answered by 10 years ago

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

0
That's not what I was asking for... Lem0nzz 5 — 10y
0
Did you really have to vote me down? Legit. SquirreIOnToast 309 — 10y
0
He didn't vote you down (currently), and it's part of the way the community is to handle bad answers/questions. User#2 0 — 10y

Answer this question