So,i already have a script,but it won’t work, i don’t know,what is the best way to do so,but here is my script:
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local GAMEPASS_ID = 1128557196
local function onPlayerAdded(player)
local success, hasGamepass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GAMEPASS_ID)
end)
if success and hasGamepass then
local character = player.Character or player.CharacterAdded:Wait()
local playerScripts = character:WaitForChild("PlayerScripts")
local helicopterHandler = playerScripts:FindFirstChild("HelicopterHandler")
local tposeHandler = playerScripts:FindFirstChild("TPoseHandler")
if helicopterHandler then
helicopterHandler.Enabled = true
end
if tposeHandler then
tposeHandler.Enabled = true
end
end
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
onPlayerAdded(player)
end
and here is my example script of the HelicopterHandler:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local Animation = humanoid:LoadAnimation(script.Animation)
local isPlaying = false
local function activateHelicopter()
if isPlaying == false then
isPlaying = true
Animation:Play()
game.ReplicatedStorage.Invisible:FireServer()
end
end
local function deactivateHelicopter()
if isPlaying == true then
isPlaying = false
Animation:Stop()
game.ReplicatedStorage.Visible:FireServer()
end
end
player.Chatted:Connect(function(message)
if message == "/e helicopter" then
activateHelicopter()
end
end)
humanoid.Running:Connect(function(speed)
if speed > 0 then
deactivateHelicopter()
end
end)