Basically the Script invokes the client and then the player is supposed to click on one of 3 buttons. When a button is clicked or 10 seconds have passed, its supposed to return a certain value.
However, it doesnt do that and doesnt return anything. After 10 seconds it returns something, but its nil. The button works because it does everything before the return part of the code.
Ive even tried wrapping it in a pcall function. It says that its successful but the server still doesnt get the returned message.
(In the video, it flashes around because theres supposed to be dialog in the cutscene, but i skipped it for the sake of testing it)
ServerScript:
local plr = game.Players:GetChildren()[1]
local choice = game.ReplicatedStorage.MakeChoice:InvokeClient(plr)
print(choice)
if choice == "KillBall" then
sounds["Dark Zone"]:Stop()
changecam(game.Workspace.CamParts.BossfightOver.BossfightOverCam1)
dialog("I'm sorry Ball Person...", "Player")
dialog("Its time for you to go", "Player")
deadballcut.PlayerClone.Gun.Handle.Attachment.Smoke:Emit(15)
deadballcut.PlayerClone.Gun.Handle.Attachment.ParticleEmitter:Emit(7)
deadballcut.PlayerClone.Gun.Handle.Attachment.ParticleEmitter:Emit(1)
deadballcut.PlayerClone.Gun.Handle.Fire:Play()
wait(0.3)
changecam(game.Workspace.CamParts.BossfightOver.BossfightOverCam2)
sounds.BallDeflect:Play()
for i = 1,5 do
ball.ShieldEffect.ParticleEmitter:Emit(1)
wait(0.08)
end
end
print("over")
LocalScript
game.ReplicatedStorage.MakeChoice.OnClientInvoke = function()
local chosen = false
local choicemenu = game.Players.LocalPlayer.PlayerGui.ScreenGui.ChoiceScreen
choicemenu.Visible = true
choicemenu.KillBall.MouseButton1Click:Connect(function()
print("Kill")
choicemenu.Visible = false
return "KillBall"
end)
choicemenu.SpareBall.MouseButton1Click:Connect(function()
choicemenu.Visible = false
return "Spare"
end)
choicemenu.KillDod.MouseButton1Click:Connect(function()
choicemenu.Visible = false
return "KillDod"
end)
wait(10)
if chosen == false then
choicemenu.Visible = false
return "slow"
end
end
script.Parent.ScreenGui.ChoiceScreen.Visible = false