Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Need to put a script into a clickdetector, but i dont know how to use them... help?

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?

1 comment

0

This is a Script with no LocalScript working. FE only makes it so localscripts can’t change other clients.

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.