I have this script:
local player = game.Players.LocalPlayer local leaderboard = player:WaitForChild("leaderstats") local price = 30 if leaderboard.Cashies.Value >= price.Value then leaderboard.Cashies.Value = leaderboard leaderboard.Cashies.Value = leaderboard.Cashies.Value - price.Value leaderboard.Pointies.Value = leaderboard.Points.Value - price.Value end 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:
local player = game.Players.LocalPlayer local leaderboard = player:WaitForChild("leaderstats") local price = 30 script.Parent.ClickDetector.MouseClick:connect(function() if leaderboard.Cashies.Value >= price.Value then leaderboard.Cashies.Value = leaderboard leaderboard.Cashies.Value = leaderboard.Cashies.Value - price.Value leaderboard.Pointies.Value = leaderboard.Points.Value - price.Value end end)
This will basically do what you want the script to do when a player clicks the part.