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

Why is my Intro Script erroring?

Asked by 9 years ago

I am very confused on why it is not working, I thought I have found the problem a few times, but the same error keeps coming up, the Output keeps saying 16:06:50.611 - TweenPosition is not a valid member 16:06:50.611 - Script 'Players.Player1.PlayerGui.IntroGui.MainScript', Line 42 16:06:50.612 - Stack End, but I am confused how it is not a Valid member, here is the script;

--Hello, Player! Thank you for using my Intro Gui, brought to you by TheeDeathCaster :)
repeat wait() until game.Players.LocalPlayer and script.Parent and script.Parent:FindFirstChild("Intro") and script.Parent:FindFirstChild("Skip")
local plr = game.Players.LocalPlayer
local intro = script.Parent:FindFirstChild("Intro") --At first I tried a 'TextLabel', but that didn't work, then I tried a 'TextButton', that didn't work either
local Sound
local Textz
local Skip = script.Parent:FindFirstChild("Skip")

-- SETTINGS --
local EnableMusic = true --Set to false if you don't want music to play during the Intro, true if you do
local MusicId = 142935414 --Set to your music ID; will be used for 'EnableMusic'
local FancyGui = true --Set to false if you don't want the Gui to be all Fancy-like, true if you do
local CustomText = true --Set to false if you don't want to make your own Custome Text for the intro, true if you do
local FancyText = true --Set to false if you don't want a Fancy Message, true if you do
local CustomMessage = "Welcome to the game, "..plr.Name.."!" --Type in the Text you want to show when the Gui is activated 'CustomeText has to be activated'
local AllowSkip = true --Set to false if you don't want the Player to skip the Intro, true if you do

-- MAIN SCRIPT --
if plr:FindFirstChild("Done") then script.Parent:Destroy() end
intro.Position = UDim2.new(1,0,1,0)

if EnableMusic then
Sound = Instance.new("Sound",plr.PlayerGui)
Sound.Name = "Intro Music"
Sound.Looped = true
Sound.Archivable = false
Sound.PlayOnRemove = false
Sound.SoundId = "http://www.roblox.com/asset/?id="..MusicId
repeat Sound:Stop() wait(.1) Sound:Play() wait(.1) until Sound.IsPlaying
end

if AllowSkip and Skip then
Skip.MouseButton1Down:connect(function() local Done = Instance.new("BoolValue",plr) Done.Name = "Done" Sound:Stop() script.Parent:Destroy() end)
elseif not AllowSkip and Skip then
Skip:Destroy()
end

repeat wait() until intro:IsA("TextButton") and intro.Position

if FancyGui and intro then
if AllowSkip then
intro.Position:TweenPosition(UDim2.new(0,0,0.1,0),"Out","Quad") --It says the Error is here
intro.Size = UDim2.new(1,0,0.9,0)
else
intro.Position:TweenPosition(UDim2.new(0,0,0,0),"Out","Quad") --Also here when you set 'AllowSkip' to false
intro.Size = UDim2.new(1,0,1,0)
end
elseif not FancyGui and intro then
if AllowSkip then
intro.Position = UDim2.new(0,0,0.1,0)
intro.Size = UDim2.new(1,0,0.9,0)
else
intro.Position = UDim2.new(0,0,0,0)
intro.Size = UDim2.new(1,0,1,0)
end
end

if AllowSkip then
repeat wait() until intro.Position == UDim2.new(0,0,0.1,0)
else
repeat wait() until intro.Position == UDim2.new(0,0,0,0)
end

if CustomText then
Textz = CustomMessage
else
Textz = "Welcome to the game!"
end

if FancyText then
for i = 1, #Textz do
intro.Text = Textz:sub(0,i)
wait(1/19)
end
wait(#Textz/19+4.5)
else
intro.Text = Textz
wait(#Textz/19+4.5)
end

local Done = Instance.new("BoolValue",plr)
Done.Name = "Done"
wait(#"Done"/19+2.5)
Sound:Stop()
script.Parent:Destroy()

1 answer

Log in to vote
2
Answered by 9 years ago

TweenPosition is a method of GuiObject and not the Position property.

intro:TweenPosition(UDim2.new(0,0,0.1,0),"Out","Quad")
0
Wow, I can't believe I didn't notice that. o_e In all my time, I've never done such a funny mistake. Lol, Thanks man. :) This helped allot. :) TheeDeathCaster 2368 — 9y
Ad

Answer this question