What do you want to achieve? Keep it simple and clear!
I want to make the play button play a cutscene after it’s pressed. Simple as that.
What is the issue? Include screenshots / videos if possible!
I don’t know exactly the code to use for a BindableEvent, Both scripts are local which means its a client to client communicator. I’ve put in the play button script the code below to fire the event, but nothing is happening. I think I’m forgetting a piece of code to refer to the bindable event.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried using Remote events but that didn’t seem to work. I have a BoolValue tied from the cutscene script tied to the BindableEvent so that’s not the issue.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local lPlr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Sound:Play()
script.Parent.Parent:TweenPosition(UDim2.new(0, 0,1.993, 0),"Out","Quint",1,true)
wait(0.55)
script.Parent.Parent.Visible = false
game:GetService("StarterGui"):SetCore("TopbarEnabled", true)
game.Workspace.OnPlay:FireClient() --This is where I think the bug is located. Everything else works properly but this line of code (the event is titled OnPlay)
game.Workspace.ChildAdded:connect(function(Child)
if lPlr then
wait()
lPlr.CameraMode = 0
lPlr.CameraMode = 1
end
end)
end)
how does the other script look? did you make sure the other script is actually connecting to the event? maybe it’s disabled or somewhere local scripts dont run
and maybe it is firing properly but the function connected isnt working properly
The script itself is prewritten, just like everything I’m using since I’m so new to scripting, but right here in StarterCharacterScripts is this local script meant to trigger a cutscene that I designed. It’s bound properly as there’s an ObjectValue child for the script that tethers itself to the BindableEvent (located in replicated storage
if PlayOnEventFire then
local e = PlayOnEventFire.Value
if e and e:IsA("BindableEvent") then
e.Event:Connect(PlayCutscene)
end
PlayOnEventFire:Destroy()
end
Okay I changed it to :Fire() and still no positive results. I’ll try putting the bindable event itself into workspace instead of replicated storage and see if that works
In your code you set the e variable to the value of a Bindable Event (Which a Bindable Event does not have)
Both the sending and receiving script have to be local scripts
All you have to do is call your bindable event ex workspace.BindableEvent:Fire()
and on the other receiving end of that event put workspace.BindableEvent.Event:Connect(function(AnyValueYouSend)
-- What you want to accomplish such as playing the cutscene
end)
The Value is thru an Object Value from a separate child from the cutscene LocalScript itself, and it’s bound to the BindableEvent. I think where my problem lies is in the line where I fire it. The Cutscene script has several BoolValues and Object Values like “PlayOnCharacterAdded, PlayOnPartTouch, and the one I’m using which is PlayOnEventFire/PlayOnRemoteEventFire” I tethered the PlayOnRemoteEventFire to the actual Remote Event and I put code in the Play button to fire the event when pressed. I was expecting the event to fire to trigger the cutscene to play but I’m at a loss here. I’ll try putting in the receiving end code and I’ll let you know what happens
Here’s how the scripts look alongside my explorer tab. You can see the LocalScript that is in charge of looking for an event fire has the bindable event tethered to the event in workspace. It also has several other properties that I manually disabled (its the cutscene plugin which allows for a wide select option of ways to trigger the cutscene). I’ve easily done this with a part touch but when it comes to making a GUI trigger the cutscene it’s somehow unbelievably difficult for me.