Hi. With the new update of Roblox, the Tween servive is not accessible in a global script. So, I need to move my script, in a LocalScript, but I don't know how to change it to a LocalScript. Can someones help me?
P.S. Sorry if you don't understand my English. I hope you'll understand it.
local identifier = "medallion1"
local stat = "Medallions"
local description = "You got the Medallion of Forest!"
local respawn = true
local debounce = false
script.Parent.Touched:connect(function(part)
if not debounce then
debounce = true
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
if player:findFirstChild("OneTimeItems") and player:findFirstChild("leaderstats") then
if not player.OneTimeItems:findFirstChild(identifier) then
local newidentifier = Instance.new("Accoutrement",player.OneTimeItems)
newidentifier.Name = identifier
local stats = player.leaderstats:findFirstChild(stat)
if stats then
stats.Value = stats.Value + 1
else
print(stat.." not found in leaderstats")
end
local newgui = player.PlayerGui.ItemGet
newgui.Frame.Description.Text = description
Spawn(function()
newgui.Frame:TweenPosition(UDim2.new(0.5, -150, 0.5, -60), "Out", "Elastic", 2)
wait(13)
newgui.Frame:TweenPosition(UDim2.new(0.5, -150, 0, -300), "Out", "Elastic", 2)
wait(1)
if player:findFirstChild("Checkpoint") then
player.Checkpoint.Value = Vector3.new(5.6, 97, -3.4)
end
if respawn then
if player:findFirstChild("Checkpoint") then
player.Checkpoint.Value = Vector3.new(5.6, 97, -3.4)
end
player:LoadCharacter()
else
newgui:Destroy()
end
end)
else
local newgui = workspace.MainGameScript.ItemGet:clone() --"ItemGet" is suppose to be in my StarterGui
newgui.Parent = player.PlayerGui
newgui.Frame.Description.Text = "You already have this Medallion!"
Spawn(function()
newgui.Frame:TweenPosition(UDim2.new(0.5, -150, 0.5, -60), "Out", "Elastic", 2)
wait(13.5)
newgui.Frame:TweenPosition(UDim2.new(0.5, -150, 0, -300), "Out", "Elastic", 2)
wait(1)
if respawn then
if player:findFirstChild("Checkpoint") then
player.Checkpoint.Value = Vector3.new()
end
player:LoadCharacter()
else
newgui:Destroy()
end
end)
end
end
end
debounce = false
end
end) |