Type Error: (46,5) Type ‘self’ could not be converted into ‘self’
caused by:
Type ‘Participant’ could not be converted into ‘Participant’
caused by:
Type ‘Participant’ from ‘game.ServerScriptService.Server.Classes.Participant’ could not be converted into ‘Participant’ from ‘game.ServerScriptService.Server.Classes.Participant’
So I just got this error and I completely have no idea what this means.
SuguruDev
(SuguruDev)
January 5, 2023, 10:58am
#2
Mind telling me what line this error is taking place on?
This is from line 46, character 5.
SuguruDev
(SuguruDev)
January 5, 2023, 11:02am
#4
I sadly have no idea on how to use “Self” and this may not be much of a help.
So I will link some Dev forums and hopefully they help you!
Links : Why can I never use self?
You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I would like to make a character controller of @EgoMoose se
What is the issue? Include screenshots / videos if possible!
I don’t know what self is.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I don’t find a post that read about self.
I don’t want you to write a whole code, but a simple example would be …
I don’t know much about Luau typing but I am just simply having this warning while putting my mouse over the function.
Type’() → ()’ could not be converted into '(any) → g39
(I have no idea what g39 is supposed to be)
The code is just my attempt to assign a function to a BindableFunction’s OnInvoke property:
--!strict
local bindable: BindableFunction = Instance.new("BindableFunction")
bindable.OnInvoke = function()
end
Anyone know a fix or how to avoid this warning entirely?
Sorry im not much of a help.
I don’t really know, I think this must be a Type checking bug.
SuguruDev
(SuguruDev)
January 5, 2023, 11:03am
#6
Possibly, as I said I have no knowledge in “Self” sadly, and wont be much of a help.
I say try experimenting with other ways to do it, and see if that works.
You might need to be more explicit with the typing.
For example, instead of t:k(), try doing
t.k(self: T)
The code will continue work as expected.
If you want a quick hack you can use this pattern to declare a genericless object with a metatable
type x = typeof(setmetatable({}::{
}, {}::{
}))
3 Likes
system
(system)
Closed
January 22, 2023, 8:35pm
#9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.