Can somebody help me fix this script? So it does half of what it's supposed to do. The second part, was from someone else helping me out, but it may have some errors to it. I need some fixes, so here's what part 2 is supposed to do, and part 1 is supposed to do
Part 1 is supposed to insert the ID, of the texture into the texture link, so it will change the swords TextureID, to what you put in it. This script works, so It doesn't need any fixes.
repeat wait() until game.Players.LocalPlayer
local player = Game.Players.LocalPlayer
local swordMesh = script.Parent
local GuiBar = player.PlayerGui.ScreenGui.Frame.TextBox
GuiBar.FocusLost:connect(function()
pcall(function()
swordMesh.TextureId = "http://www.roblox.com/asset/?id="..tostring(tonumber(GuiBar.Text)-1)
end)
end)
However part 2 is the one that's bugging me. Part 2 is supposed to save the texture so when a player was to die, then they would keep it. So it'd resolve the issue with people having to put the ID into the GUI constantly. Part 2 doesn't work, can somebody fix this?
function saveData(player)
player:SaveInstance("SwordTextureId", swordMesh.TextureId)
end
function loadData(player)
swordMesh.TextureId = player:LoadInstance("SwordTextureId")
end
function onUpdate()
if game.Players.LocalPlayer.Character.Humanoid.Health <= 0 then
saveData(game.Players.LocalPlayer)
end
wait(0.5)
onUpdate()
end

1 comment
Didn't work.