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

Put this in a local script wont work no output what's problem?

Asked by 10 years ago

Help me please, this script's supposed to change a sword's mesh TextureID, when you type a ID from the catalog, into the TextBox. But the thing is, when I type it in, it wont work, I tried both local, and non local scripts, and yet it still wont work, I put it into the mesh, so that's it's parent, yet I made the path, and it wont get to it correctly. Could somebody help me out? Here's the script that wont work.

local player = Game.Players.LocalPlayer

local swordMesh = script.Parent

local GuiBar = player.PlayerGui.StarterGui.Frame.TextBox -- If this isn't the right way to find the path, someone fix it please.

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)\

end)
end)
0
There's no output problem, I really do need help. Lem0nzz 5 — 10y

1 answer

Log in to vote
1
Answered by
Bebee2 195
10 years ago

On line 5 is that StarterGui the name of the ScreenGui?

local GuiBar = player.PlayerGui.StarterGui.Frame.TextBox -- If this isn't the right way to find the path, someone fix it please.

On line 11, remove that random \

swordMesh.TextureId = "http://www.roblox.com/asset/?id="..tostring(tonumber(GuiBar.Text)-1)\

And at the top, add

repeat wait() until game.Players.LocalPlayer

This script has to be LocalScript btw.

0
Best guess that the error is in the function inside call since that almost entirely masks the error unless you set values to it. Bebee2 195 — 10y
0
*pcall Blame my iPad on that comment above. Bebee2 195 — 10y
0
Thanks man it works now!! Lem0nzz 5 — 10y
Ad

Answer this question