detect = workspace.Lottery.Man.Head
detect.ClickDetector.MouseClick:Connect(function(plr)
if math.random(1, 100) == math.random(1, 100) then
game:GetService("Chat"):Chat(detect, "You have won the lottery! Congratulations", "Red")
elseif plr.Name == "HappyTimIsHim" then
game:GetService("Chat"):Chat(detect, "You have won the lottery! Congratulations", "Red")
else
game:GetService("Chat"):Chat(detect, "You have lost the lottery. Better luck next time!", "Red")
end
end)
I have made a lottery script for a man. But when I click the head it doesn't do anything. Also if nothing works let me tell u something. I made a hitbox called head and made the normal head named "fakehead" cuz i was too lazy to changed anything.
First script is in StarterGui. Second script is in the clickdetector. The Remote Event is in Replicated storage.

5 comments
MouseClick should only be used on the server. this will help, because in turn, you wont need a remote event
:/ i have one
Wait what do you mean gioni1, he has a RemoteEvent on the Server?
i changed it :/
cuz of gioni