Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why isn't my click detector working? [no errors]

Asked by 5 years ago
Edited 5 years ago
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.

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

1 answer

Log in to vote
1
Answered by 5 years ago
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)
0
oh HappyTimIsHim 652 — 5y
0
pretty good script HappyTimIsHim 652 — 5y
0
i bet u didn't copy and paste HappyTimIsHim 652 — 5y
0
totally didnt Gey4Jesus69 2705 — 5y
View all comments (2 more)
0
Explain. yHasteeD 1819 — 5y
0
we solved this in chat Gey4Jesus69 2705 — 5y
Ad

Answer this question