#local script stops when it isn't client sided
1 messages · Page 1 of 1 (latest)
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
Its the New Codes Otaku Cutscene Plugin
how about sending the script?

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 ()
ok this part disturbed me, but the implementation for the wait function can just be entirely replaced with task.wait()
Noted!
aslo the note before the function declaration isnt commented, is this in the real script?
add // before commented text
Forwarding over this info to harv!!
** You are now Level 1! **
yeahyeah i forgot
// is other things like java
Isk why lya even uses -- tbh
The ctrl+/ still comments it too
lol yeah i kinda remembered the c++ one that ime
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
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
let me send
** You are now Level 1! **
examples
is this entire thing in a while true loop
idk if u have more
no
since
i dont want the cutscene to loop
i think it has something to do with
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
???
the touch dialogue
can you eleborate
i was asking xd
** You are now Level 6! **
let me try
also this title is really confusing
"local script stops when it isn't client sided"
local scripts only function by the client
i meant
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😭
Like it plays in roblox studio solely for harv but it doesn’t play for anyone else
^
so if harv does it, then it works
by harvs client
Yeah
Yes
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
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
thats how the script was
do you want me to try and remoce it
to see if anything works
sure
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
NOOOOO
SO THATS WHAT THE TITLE IS ABOUT 😭
its inconsistent
YEA LOL
OH.
if you want to make the server see it
um
nvm
find out if demo:Play() can work in a server-side script
in the local script
** You are now Level 2! **
?
add a remote event in replicated storage
nononono
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
im a little lost.,,, sorry im new to this
since this is a singleplayer game
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
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
do you test it in studio too or in the game page?
game page
and its being really weird
publish changes to roblox
i did that
you test your main in studio or also in the game page?
game page
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
ummmm im just gonna throw extremely unneeded advice here
is the localscript in starterplayer
what does this mean
LIke on my side
so if thomas joins the game
and does the correct steps
ON HIS CLIENT, he wont see it?
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
your testing the game on studio and it works
but is your alt also testing on studio?
no
Hey thank you a lot for offering and providing help, I think it might be fixed now. We appreciate it greatly !!!
** You are now Level 2! **
did it work?
yo did it work?
Yes it started working!!