I have this script:
01 | local player = game.Players.LocalPlayer |
02 | local leaderboard = player:WaitForChild( "leaderstats" ) |
03 | local price = 30 |
04 |
05 | if leaderboard.Cashies.Value > = price.Value then |
06 | leaderboard.Cashies.Value = leaderboard |
07 | leaderboard.Cashies.Value = leaderboard.Cashies.Value - price.Value |
08 | leaderboard.Pointies.Value = leaderboard.Points.Value - price.Value |
09 | end |
10 | end ) |
I wanna make this script have a "Click detector" on it, But not only that, Because my game is filtering enabled, how to i make the script filtering enabled?
Add a ClickDetector on a part and put that script in the part too. Then change your script into this:
01 | local player = game.Players.LocalPlayer |
02 | local leaderboard = player:WaitForChild( "leaderstats" ) |
03 | local price = 30 |
04 |
05 | script.Parent.ClickDetector.MouseClick:connect( function () |
06 | if leaderboard.Cashies.Value > = price.Value then |
07 | leaderboard.Cashies.Value = leaderboard |
08 | leaderboard.Cashies.Value = leaderboard.Cashies.Value - price.Value |
09 | leaderboard.Pointies.Value = leaderboard.Points.Value - price.Value |
10 | end |
11 | end ) |
This will basically do what you want the script to do when a player clicks the part.