I made a gamepass for when you buy it you get custom animation which works fine, but now im working on a button to disable the animations script, but cant figure out how to access the players character, since im still kinda new to scripting, so what im trying to do is, if they click the button, it turns the animations off, if its clicked again it turns it back on.
but cant find the Animation script inside the player
What I tried so far is
– The Script that gets the Gui and enable it if player has the gamepass which works inside ServerScriptService
game.Players.PlayerAdded:Connect(function(player)
if game:GetService(“MarketplaceService”):UserOwnsGamePassAsync(player.UserId, 13303076) then
player.PlayerGui.AnimEnabler.Enabled = true
else
player.PlayerGui.AnimEnabler.Enabled = false
end
end)
Script that makes the gui work and function in StarterGui
local OnandOff = script.Parent.OnAndOff – Gets the Button in the Gui
local player = game.Players.LocalPlayer:GetCharacterFromPlayer() – Gets the Local Player
local Animations = player.Animations – Gets the Animations script inside the player
OnandOff.MouseButton1Click:Connect(function()
if Animations.Disabled == true then
Animations.Disabled = false
OnandOff.Text = “Animations On”
else
Animations.Disabled = true
OnandOff.Text = “Animations Off”
end
end)
sorry if everything is confusing,