Hey, so the thing is, I want to create a server-sided message with clickdetector that tells the players who activated the emergency generator for my game, but it doesn’t work and I don’t see any warning in the output that shows the cause, what is wrong with my script?
Message is Deprecated
and :Remove() is also Deprecated
debounce is a Global Variable. And lowercase :connect is also Deprecated
Try printing the player
MouseClick gives the Player as the parameter, not the character.
so how can I fix it? if message is deprecated and remove() too?
Use Destroy() instead of Remove and Connect instead of connect. And for message… Your Own gui and a RemoteEvent
message works but when I add findfirstchild, it doesn’t.
local debounce = false
function onClicked(click)
if debounce == false then
debounce = true
local message = Instance.new("Message")
message.Parent = workspace
message.Text = click.Name.." Activated The Generator"
wait(3)
message:Destroy()
debounce = true
end
end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)
click is the player who clicks the object
As @DarkContinuum stated. The first Parameter is the Player not the Character. And Message is deprecated, u can still use it. But it won’t have Bug Updates
You’re using a deprecated function, use :Destroy()
instead of :remove()
.
And make sure debounce
is a local variable (add local
before it)
Okay, thanks guys, I fixed it