I am making a ‘Fortnite Dancing Game (hold the cringe)’ and I have uploaded the animations, and I have made the script to play them. Some animations are only allowed to be used if the user has purchased a game pass. In ROBLOX Studio, the animations play when I click the buttons, and the game-pass only animations function properly. However, when I go in the game, it says that I do not own the game pass (which I do), and none of the animations will load. I checked the output, and it says that I was trying to instantiate an integer.
Code
player = game.Players.LocalPlayer
animationdab = script.Parent.Background.Dab:WaitForChild("Animation")
animationdd = script.Parent.Background.DefDance:WaitForChild("Animation")
animationfloss = script.Parent.Background.Floss:WaitForChild("Animation")
animationhype = script.Parent.Background.Hype:WaitForChild("Animation")
animationinfdab = script.Parent.Background.InfDab:WaitForChild("Animation")
animationOJ = script.Parent.Background.OJ:WaitForChild("Animation")
animationtakel = script.Parent.Background.TakeL:WaitForChild("Animation")
animationworm = script.Parent.Background.Worm:WaitForChild("Animation")
DabButton = script.Parent.Background.Dab
DefaultButton = script.Parent.Background.DefDance
FlossButton = script.Parent.Background.Floss
HypeButton = script.Parent.Background.Hype
InfDabButton = script.Parent.Background.InfDab
OJButton = script.Parent.Background.OJ
TakeLButton = script.Parent.Background.TakeL
WormButton = script.Parent.Background.Worm
OpenButton = script.Parent.DancesOpen
BackButton = script.Parent.Background.Back
Background = script.Parent.Background
enableddab = true
enableddefault = true
enabledfloss = true
enabledhype = true
enabledinfdab = true
enabledoj = true
enabledtakel = true
enabledworm = true
--[[
Animation Times:
Dab: 0.9
Default: 4.5
Floss: 3.2
Hype: 3.5
Infinite Dab: 1.8
Orange Justice: 6.2
Take the L: 1.4
Worm: 2
--]]
OpenButton.Activated:Connect(function()
if Background.Visible == true then
Background.Visible = false
else
Background.Visible = true
end
end)
BackButton.Activated:Connect(function()
Background.Visible = false
end)
--[[
--]]
-- Dab --
DabButton.Activated:Connect(function()
if enableddab then
enableddab = false
local animationtrack1 = player.Character.Humanoid:LoadAnimation(animationdab)
animationtrack1:Play()
wait(0.9)
enableddab = true
animationtrack1:Stop()
end
end)
-- Default --
DefaultButton.Activated:Connect(function()
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 6501778) then
if enableddefault then
enableddefault = false
local animationtrack2 = player.Character.Humanoid:LoadAnimation(animationdd)
animationtrack2:Play()
wait(4.5)
enableddefault = true
animationtrack2:Stop()
else
DefaultButton.TextLabel.Text = "You don't own the pass!"
wait(3)
DefaultButton.TextLabel.Text = "Default Dance ????"
end
end
end)
-- Floss --
FlossButton.Activated:Connect(function()
if enabledfloss then
enabledfloss = false
local animationtrack3 = player.Character.Humanoid:LoadAnimation(animationfloss)
animationtrack3:Play()
wait(3.2)
enabledfloss = true
animationtrack3:Stop()
end
end)
-- Hype --
HypeButton.Activated:Connect(function()
if enabledhype then
enabledhype = false
local animationtrack4 = player.Character.Humanoid:LoadAnimation(animationhype)
animationtrack4:Play()
wait(3.5)
enabledhype = true
animationtrack4:Stop()
end
end)
-- Infinite Dab --
InfDabButton.Activated:Connect(function()
if enabledinfdab then
enabledinfdab = false
local animationtrack5 = player.Character.Humanoid:LoadAnimation(animationinfdab)
animationtrack5:Play()
wait(1.8)
enabledinfdab = true
animationtrack5:Stop()
end
end)
-- Orange Justice --
OJButton.Activated:Connect(function()
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player, 6501781) then
if enabledoj then
enabledoj = false
local animationtrack6 = player.Character.Humanoid:LoadAnimation(animationOJ)
animationtrack6:Play()
wait(6.2)
enabledoj = true
animationtrack6:Stop()
else
OJButton.TextLabel.Text = "You don't own the pass!"
wait(3)
OJButton.TextLabel.Text = "Orange Justice ????"
end
end
end)
-- Take the L --
TakeLButton.Activated:Connect(function()
if enabledtakel then
enabledtakel = false
local animationtrack7 = player.Character.Humanoid:LoadAnimation(animationtakel)
animationtrack7:Play()
wait(1.4)
enabledtakel = true
animationtrack7:Stop()
end
end)
-- Worm --
WormButton.Activated:Connect(function()
if enabledworm then
enabledworm = false
local animationtrack8 = player.Character.Humanoid:LoadAnimation(animationworm)
animationtrack8:Play()
wait(2)
enabledworm = true
animationtrack8:Stop()
end
end)