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

Help me fix my animation script gui, please? Converted with plugin!

Asked by 5 years ago

Gui made by me and then transferred to script with a plugin, I tested the gui version and it worked fine, but when I use the scripted one (After converting with plugin.) One simple line wont let me play the animation at all.

Here is the script pls help :(

-- no stel pls -- Made by MrNotSoBaddy local Animation = Instance.new("ScreenGui") local TextButton = Instance.new("TextButton") --Properties: Animation.Name = "Animation" Animation.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")

TextButton.Parent = Animation TextButton.BackgroundColor3 = Color3.new(1, 1, 1) TextButton.Position = UDim2.new(0, 27, 0, 331) TextButton.Size = UDim2.new(0, 120, 0, 30) TextButton.Font = Enum.Font.SourceSans TextButton.Text = "Animation" TextButton.TextSize = 14 -- Scripts: function SCRIPT_WOBO83_FAKESCRIPT() -- TextButton.LocalScript getfenv().script = Instance.new('LocalScript', TextButton)

local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Assest?ID=2561376219"

local trackanimation = nil
local playability = true
function playAnimation(AnimationSource)
if playability == true then
local plr = game.Players.LocalPlayer
trackanimation = plr.Character.Humanoid:LoadAnimation(animation)

trackanimation.KeyframeReached:connect(function()
print('Working')
end)
trackanimation:Play()
 end
end
script.Parent.MouseButton1Click:connect(playAnimation)

end coroutine.resume(coroutine.create(SCRIPT_WOBO83_FAKESCRIPT))

0
ok for some reason the script cut off, but the entire block of script under my last sentence (Here is the script, please help :c) is all apart of it. MrNotSoBaddy -5 — 5y
0
You want it when the animation time is over, it will end up together? yHasteeD 1819 — 5y
0
I trying to fix your script. yHasteeD 1819 — 5y
0
connect is deprecated, use Connect instead ScrubSadmir 200 — 5y
0
thanks guys thank you :) MrNotSoBaddy -5 — 5y

2 answers

Log in to vote
0
Answered by
yellp1 193
5 years ago
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Assest?ID=2561376219"

local trackanimation = nil
local playability = true
function playAnimation(AnimationSource)
if playability == true then
local plr = game.Players.LocalPlayer
trackanimation = plr.Character.Humanoid:LoadAnimation(animation)

trackanimation.KeyframeReached:connect(function()
print('Working')
end)
trackanimation:Play()
 end
end
script.Parent.MouseButton1Click:connect(playAnimation)

the variable animation needs a parent. Do this instead

local animation = Instance.new("Animation", x) -- x can be the object that you are adding the animation to or even in the workspace
animation.AnimationId = "http://www.roblox.com/Assest?ID=2561376219"

local trackanimation = nil
local playability = true
function playAnimation(AnimationSource)
if playability == true then
local plr = game.Players.LocalPlayer
trackanimation = plr.Character.Humanoid:LoadAnimation(animation)

trackanimation.KeyframeReached:connect(function()
print('Working')
end)
trackanimation:Play()
 end
end
script.Parent.MouseButton1Click:connect(playAnimation)
Ad
Log in to vote
0
Answered by 5 years ago

-- no stel pls -- Made by MrNotSoBaddy local Animation = Instance.new("ScreenGui") local TextButton = Instance.new("TextButton") Properties: Animation.Name = "Animation" Animation.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")

TextButton.Parent = Animation TextButton.BackgroundColor3 = Color3.new(1, 1, 1) TextButton.Position = UDim2.new(0, 27, 0, 331) TextButton.Size = UDim2.new(0, 120, 0, 30) TextButton.Font = Enum.Font.SourceSans TextButton.Text = "Animation" TextButton.TextSize = 14 -- Scripts: function SCRIPT_WOBO83_FAKESCRIPT() -- TextButton.LocalScript getfenv().script = Instance.new('LocalScript', TextButton) local animation = Instance.new("Animation", x) -- x can be the object that you are adding the animation to or even in the workspace animation.AnimationId = "http://www.roblox.com/Assest?ID=2561376219"

local trackanimation = nil
local playability = true
function playAnimation(AnimationSource)
if playability == true then
local plr = game.Players.LocalPlayer
trackanimation = plr.Character.Humanoid:LoadAnimation(animation)

trackanimation.KeyframeReached:connect(function()
print('Working')
end)
trackanimation:Play()
 end
end script.Parent.MouseButton1Click:connect(playAnimation)

-- is this right?

Answer this question