#local script stops when it isn't client sided

1 messages · Page 1 of 1 (latest)

glacial quail
#

im trying to make a cutscene with the plugin codes otaku plugins and its just stopping after a few seconds if a user were to play the game, I am very confused and I have tried everything to make it work but it won't some help would be appreciated.

muted lily
#

stops when it isnt client sided?

#

arent localscripts themselves client sided?

muted lily
#

bro thats enough typing 😭

#

just send the current draft

pearl elbow
# muted lily arent localscripts themselves client sided?

Me and Harv are very very new at scripting but I will try my best to explain the issue.

Harv is currently trying to make a cutscene that will trigger when a player touches a part. The cutscene has been made using the Otaku plugin.

For a minute the code worked. It was tested on a backup account and it played for the roblox user. But suddenly when Harv went into the game today and tested it, the code did not work at all. I can send over what harv had in the script if it helps identify the issue. We are both trying to figure it out but are very lost on what happened

muted lily
#

ok

#

whats the otako plug tho?

pearl elbow
#

Its the New Codes Otaku Cutscene Plugin

pearl elbow
# pearl elbow Me and Harv are very very new at scripting but I will try my best to explain the...

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local CodesOtaku = ReplicatedStorage:WaitForChild("CodesOtaku")
local CutsceneModule = CodesOtaku:WaitForChild("CutsceneModule")

repeat wait() until workspace.CurrentCamera -- Wait until camera is found

local Camera = workspace.CurrentCamera
local Looping = false
local Speed = 1
local FreezeControls = false

local CutsceneFolder = workspace.Cutscenes:WaitForChild("sigh")
local Destroy = true
local NoYield = false
local SafeMode = true

local Cutscene = require(CutsceneModule)

local Demo = Cutscene.new(Camera, Looping, Speed, FreezeControls)
Demo:Load(CutsceneFolder, Destroy, NoYield, SafeMode)

local PlayOnPartTouch = script:FindFirstChild("PlayOnPartTouch")
local PlayOnPlayerJoin = script:FindFirstChild("PlayOnPlayerJoin")
local PlayOnCharacterAdded = script:FindFirstChild("PlayOnCharacterAdded")
local PlayOnCharacterDied = script:FindFirstChild("PlayOnCharacterDied")
local PlayOnEventFire = script:FindFirstChild("PlayOnEventFire")
local PlayOnRemoteEventFire = script:FindFirstChild("PlayOnRemoteEventFire")
local ProtectTheCharacterWhilePlaying = script:FindFirstChild("ProtectTheCharacterWhilePlaying")
local CharacterProtector = script:FindFirstChild("CharacterProtector")
local Music = script:FindFirstChild("Music")
local StopMusicWhenFinished = script:FindFirstChild("StopMusicWhenFinished")
local StopOnEventFire = script:FindFirstChild("StopOnEventFire")
local StopOnRemoteEventFire = script:FindFirstChild("StopOnRemoteEventFire")
local PlayOnce = script:FindFirstChild("PlayOnce")
local Debounce = script:FindFirstChild("Cooldown")
local OnFinishedRemove = script:FindFirstChild("OnFinishedRemove")
local bin = true
local Player = game:GetService("Players").LocalPlayer
local CutsceneGui = script:FindFirstChild("Cutscene")

local duration = Demo:GetDuration()

implementation for the wait function
function wait_time(duration)
local start = tick()
local Heartbeat = game:GetService("RunService").Heartbeat
repeat Heartbeat:Wait() until (tick() - start) >= duration
return (tick() - start)
end

function PlayCutscene()
if bin then
bin = false
Music:Play()
if ProtectTheCharacterWhilePlaying and ProtectTheCharacterWhilePlaying.Value and Player.Character then
CharacterProtector.Parent = Player.Character
end
Demo:Play()
end
end

Demo.EStop.Event:Connect(function()
wait_time(Debounce.Value)
CharacterProtector.Parent = nil
if PlayOnce then
if not PlayOnce.Value then
bin = true
end
else
bin = true
end
if StopMusicWhenFinished and StopMusicWhenFinished.Value then
Music:Stop()
if OnFinishedRemove then
for i,v in pairs(OnFinishedRemove:GetChildren()) do
if v:IsA("ObjectValue") then
if v.Value then
v.Value:Destroy()
end
end
end
end
end
end)

RunService.RenderStepped:Connect(function(Delta)
Demo:Update(Delta)
end)

if PlayOnPlayerJoin and PlayOnPlayerJoin.Value then
-- Play the cutscene
PlayCutscene()
end

if PlayOnPartTouch then
local part = script.PlayOnPartTouch.Value
if part and part:IsA("BasePart") then
part.Touched:Connect(function(hit)
if hit.Parent == Player.Character then
PlayCutscene()
end
end)
end
PlayOnPartTouch:Destroy()
end

#

if PlayOnEventFire then
local e = PlayOnEventFire.Value
if e and e:IsA("BindableEvent") then
e.Event:Connect(PlayCutscene)
end
PlayOnEventFire:Destroy()
end

if PlayOnRemoteEventFire then
local e = PlayOnRemoteEventFire.Value
if e and e:IsA("RemoteEvent") then
e.OnClientEvent:Connect(PlayCutscene)
end
PlayOnRemoteEventFire:Destroy()
end

if StopOnRemoteEventFire then
local e = StopOnRemoteEventFire.Value
if e and e:IsA("RemoteEvent") then
e.OnClientEvent:Connect(function()
Demo:Stop()
end)
end
StopOnRemoteEventFire:Destroy()
end

if StopOnRemoteEventFire then
local e = StopOnRemoteEventFire.Value
if e and e:IsA("RemoteEvent") then
e.OnClientEvent:Connect(function()
Demo:Stop()
end)
end
StopOnRemoteEventFire:Destroy()
end

if CutsceneGui then
CutsceneGui.Parent = Player:WaitForChild("PlayerGui")
local SkipCutsceneButton = CutsceneGui:FindFirstChild("SkipCutscene", true)
local PlayCutsceneButton = CutsceneGui:FindFirstChild("PlayCutscene", true)

if SkipCutsceneButton and SkipCutsceneButton:IsA("GuiButton") then
    SkipCutsceneButton.MouseButton1Click:Connect(function()
        Demo:Stop()
    end)
end

if PlayCutsceneButton and PlayCutsceneButton:IsA("GuiButton") then
    PlayCutsceneButton.MouseButton1Click:Connect(function()
        PlayCutscene()
    end)
end
Demo.EStop.Event:Connect(function()
    CutsceneGui.Enabled = false
end)

end

local Character = Player.Character or Player.CharacterAdded:Wait()

if PlayOnCharacterAdded and PlayOnCharacterAdded.Value then
PlayCutscene()
end
if PlayOnCharacterDied and PlayOnCharacterDied.Value then
local Humanoid = Character:WaitForChild("Humanoid")
Character:WaitForChild("Humanoid").Died:Connect(function()
PlayCutscene()
end)
end

end
PlayOnCharacterAdded:Destroy ()

muted lily
pearl elbow
#

Noted!

muted lily
#

aslo the note before the function declaration isnt commented, is this in the real script?

#

add // before commented text

pearl elbow
#

Forwarding over this info to harv!!

gritty echoBOT
#

studio** You are now Level 1! **studio

muted lily
#

inform him that its before the wait function declaration

#

WAIT

#

ITS --

unborn slate
#

Nvm lol

muted lily
#

yeahyeah i forgot

unborn slate
#

// is other things like java

#

Isk why lya even uses -- tbh

#

The ctrl+/ still comments it too

muted lily
glacial quail
#

okay so

#

for the script theres no issues until i add a touch dialogue to it

#

then when i do

#

for some reason

#

itll stop working

#

for no entire reason

#

client sided itll work

#

but if i do an actual game

#

itll stop working

muted lily
#
if PlayOnPartTouch then
    local part = script.PlayOnPartTouch.Value
    if part and part:IsA("BasePart") then
        part.Touched:Connect(function(hit)
            if hit.Parent == Player.Character then
                PlayCutscene()
            end
        end)
    end
    PlayOnPartTouch:Destroy() -- remove this
end
#

oh wait nvm

#

or actually

glacial quail
#

let me send

gritty echoBOT
#

studio** You are now Level 1! **studio

glacial quail
#

examples

pearl elbow
#

i sent over the like

#

Entire code u had

muted lily
#

is this entire thing in a while true loop

pearl elbow
#

idk if u have more

glacial quail
#

since

#

i dont want the cutscene to loop

#

i think it has something to do with

muted lily
#

is the flaw in

if PlayOnPartTouch then
    local part = script.PlayOnPartTouch.Value
    if part and part:IsA("BasePart") then
        part.Touched:Connect(function(hit)
            if hit.Parent == Player.Character then
                PlayCutscene()
            end
        end)
    end
    PlayOnPartTouch:Destroy()
end

???

glacial quail
#

the touch dialogue

muted lily
#

like if you use this function does it break?

#

i added question marks at the end xd

muted lily
gritty echoBOT
#

studio** You are now Level 6! **studio

glacial quail
#

ohhh

#

xd

glacial quail
muted lily
#

also this title is really confusing

#

"local script stops when it isn't client sided"
local scripts only function by the client

glacial quail
#

i meant

pearl elbow
#

What would be a better way to describe the issue? Again we’re pretty new so we will have a lot of lingo incorrect lol😭

glacial quail
#

like studio sided

#

like itll only work if i do it

#

not

#

orhers

pearl elbow
#

Like it plays in roblox studio solely for harv but it doesn’t play for anyone else

glacial quail
#

^

muted lily
#

by harvs client

pearl elbow
#

Yeah

muted lily
#

and if anyone else does it

#

it doesnt work

pearl elbow
#

Yes

muted lily
#

by harvs client

#

or are you inspecting the other users' clients?

pearl elbow
#

We had another person test the cutscene yesterday and it seemed to have triggered for them and worked, but today it has gone right back to the issue that we had prior. It’s only playing for harv again. If I were to hop onto the game and try to trigger the cutscene it wont work for me. It’ll only do it for harv. We’re trying to fix it so that anyone who plays the game and reaches that specific section of the game can see the cutscene

#

If it adds any context (idk if it does LOL) its kind of a singleplayer story game

muted lily
#

is StopOnRemoteEventFire being called?
and why is there 2 of them

#

one will be destroyed, then you will be indexing nil with Value

#

did u do that on purpose

glacial quail
#

thats how the script was

#

do you want me to try and remoce it

#

to see if anything works

muted lily
#

sure

glacial quail
#

nope

#

it only works on my end

#

it worked again but then stopped

#

i need it to work like

#

on the server and not just my end

muted lily
#

SO THATS WHAT THE TITLE IS ABOUT 😭

glacial quail
#

its inconsistent

pearl elbow
#

YEA LOL

muted lily
#

WHYYYYYY

#

localscripts only function by the client

pearl elbow
#

OH.

muted lily
#

if you want to make the server see it

#

um

#

nvm

#

find out if demo:Play() can work in a server-side script

glacial quail
#

in the local script

gritty echoBOT
#

studio** You are now Level 2! **studio

glacial quail
#

?

muted lily
#

add a remote event in replicated storage

glacial quail
#

i also have a theory

#

that the script doesnt load into to the game fast enough

muted lily
#

inside of playcutscene(), call the remote event

#

like

[path_to_remote_event]:FireServer()
#

replace [path_to_remote_event] ofc 😭

#

and in a server script

#

UMMM'

#

ok

glacial quail
#

im a little lost.,,, sorry im new to this

muted lily
#

its not important if anyone else sees the cutscene

#

your on your own in these games

#

localscripts have as large power as server-sided scripts

#

theres no issue dw

glacial quail
#

okay

#

so

#

why doesnt it work

#

for other players

#

because

#

when im testing the game on studio

#

it works

#

but if i go into an alt

#

and test the game

#

it doesnt wanna work

muted lily
glacial quail
#

and its being really weird

muted lily
#

publish changes to roblox

glacial quail
#

i did that

muted lily
#

ofc its in studio right?

glacial quail
#

works

#

my alt

#

no

muted lily
glacial quail
#

game page

pearl elbow
#

Hm. Okay so it worked for harv’s alt like one time but for some reason its being really inconsistent. Sometimes it works and sometimes it just doesn’t want to

muted lily
#

ummmm im just gonna throw extremely unneeded advice here

#

is the localscript in starterplayer

muted lily
glacial quail
#

LIke on my side

muted lily
#

so if thomas joins the game

#

and does the correct steps

#

ON HIS CLIENT, he wont see it?

pearl elbow
#

yes I will not see the cutscene

#

But we want it so that I (and whoever else joins the singleplayer game in the future) will be able to see it / the cutscene will play for them

muted lily
#

but is your alt also testing on studio?

glacial quail
#

no

muted lily
#

let ur alt test on studio

#

see what happens

pearl elbow
#

Hey thank you a lot for offering and providing help, I think it might be fixed now. We appreciate it greatly !!!

gritty echoBOT
#

studio** You are now Level 2! **studio

muted lily
#

yo did it work?

pearl elbow