Script Help 2: Click Part to Kick Player is not working

I used this script to kick a player when they do not click a part in time, and it was working before but is now not working. I tried reverting the whole script back to normal and it still does not work, any tips?


If you need any other scripts that need to be seen I can reply with the code.

1 Like

So your trying to make a part that if you don’t touch/click in time you get kicked.

1 Like

Yeah and it was working before but maybe an input somewhere else made it not work

1 Like

Did you have a clickDetector before.

1 Like

If you mean on the door then yes I am pretty sure, but I can double check

1 Like

Okay yes I did have one before the script was not working

1 Like

try

script.Parent.ClickDetectorName.MouseButton1Click:Connect(function()
what you want to do

end)```
1 Like

“script.Parent.ClickDetectorName.MouseButton1Click:Connect(function()”
If it connects said function, then the “Player:kick:(“reason here”)” Would not work un;\less this function was inside the other function I believe

1 Like

Just Noticed something Their is a property called MouseClick? I Always thought it was MouseButton1Click or MouseButton2Click

1 Like

idk if it is different, because the script is currently located inside the part that is clicked, maybe it is different? I really do not know

1 Like

You Can Do a Bool Value, and have it false as Default

then do

script.Parent.ClickDetector.MouseButton1Click:Connect(function()
script.BoolValue.Value = true
wait(5)
if script.BoolValue.Value == false then
game.ReplicatedStorage.Checker:FireServer(waitTime)
end
end)
1 Like

Don’t Recommend this but okay, it might not work

1 Like

I Think It has ti be be LocalScript Since If you do a normal script, the server doesn’t know who to kick.

1 Like

Wrong.
Players can only be kicked from the server.

1 Like

Screen Shot 2021-06-27 at 12.18.36 PM

So I change the script to LocalScript? The screenie was just to make sure I know where the BoolValue should go

That Could Work but what if the character never interacts with the Part, how are we going to get the player?

yes you can put the boolvalue where ever

and last thing, where in my current script does the script piece provided go (or in a different/new script entirely)

Really, Don’t know what you mean, but in the script you can have

script.Parent.Deez.MouseButton1Click:Connect(function()

script.Value.Value = true

wait(5)
if script.Value.Value == false then
game.Player.LocalPlayer:Kick("Did not interact with Part")
    end
end)

Do I put my whole script in local script, just want to make sure before I get confused