:setcore not working?

ok so i was using the coregui function but it kept bugging and saying:
“Setcore is not a valid member of playergui”
code:

local rep = game.ReplicatedStorage
local S_Message = rep.Events.Message
local player = game.Players.LocalPlayer
local gui = player:WaitForChild("PlayerGui")

local one = "Okay."
local two = nil

function script.response.OnInvoke(Button)
	if Button == one then
		print("yeet")
	end
end

S_Message.OnClientEvent:Connect(function(message:string)
	gui:SetCore("SendNotification", {
		Title = "Message",
		Text = message,
		--icon
		Duration = 8,
		CallBack = script.response,
		Button1  = one
	})
end)

Ive re-looked the code twice but its still bugging, and the documentation isnt helping either.
edit: and yes this is just a test for testing purposes.

edit2: i replaced the player.playergui with game.startergui BUT NOW THE CALLBACK IS BROKEN

1 Like

Try using BindableFunction for the call back, give me a second i will write the script rn.

1 Like

I did??? Idk man, the script is parented to a bindable fucntion

1 Like

I meant smth like this:

local rep = game.ReplicatedStorage
local S_Message = rep.Events.Message
local player = game.Players.LocalPlayer
local gui = game:GetService("StarterGui")

local one = "Okay."

local bindable = Instance.new("BindableFunction")
bindable.OnInvoke = function(Button)
	if Button == one then
		print("yeet")
	end
end

S_Message.OnClientEvent:Connect(function(message)
	gui:SetCore("SendNotification", {
		Title = "Message",
		Text = message,
		Duration = 8,
		Callback = bindable,
		Button1 = one
	})
end)
2 Likes

Thanksss!! I still dont have a clue how to use bindablefunctions but ig it works now!

1 Like