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

How do I fix this? my cutscene it isnt playing and i want it to play when only new players join

Asked by 2 years ago
Edited 2 years ago

I actually am VERY new to scripting so i just used these from a couple devforums and I'm not sure why its not working because it seems somewhat logical to me:

local CoinsDataStore = game:GetService("DataStoreService"):GetDataStore("Coins") game.Players.PlayerAdded:connect(function(Player) local CoinData = CoinsDataStore:GetAsync(Player.UserId)

local Coins = Instance.new("IntValue")
Coins.Name = "Money"

local NewPlayer = false

if CoinData ~= nil then
    Coins.Value = CoinData
else
    NewPlayer = true
    CoinsDataStore:SetAsync(Player.UserId, 0) -- start new data
end

if NewPlayer = true then        
    local TweenService = game:GetService("TweenService")

    local camera = game.Workspace.Camera

    local cutsceneTime = 12

    local tweenInfo = TweenInfo.new(
        custsceneTime,
        Enum.EasingStyle.Sine,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )

    function tween (part1,part2)
        camera.CameraType = Enum.CameraType.Scriptable
        camera.CFrame = part1.CFrame

        local tween = TweenService:Create(camera, tweenInfo,  {CFrame = part2.CFrame})
        tween:play()

        wait(cutsceneTime)

        camera.CameraType = Enum.CameraType.Custom
    end

    wait(0)

    tween(game.Workspace.Cam1.game.Workspace.Cam2)
end

end)

0
Where is the script located? StarterCharacterScripts? SamZeKat 28 — 2y
0
Its located in serverscriptstorage User#48332 0 — 2y
0
make a bool value in the players datastore and check if it is false then play the cutscene, change it to true after the cutscene is finished Donut792 216 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

You can't get the players Camera from the server, you would have to fire a RemoteEvent from the server script to a local script in StarterPlayerScripts (or StarterCharacterScripts)

Ad

Answer this question