So, to start off with..
It is in a Local Script.
I'm creating a shop script, that you can only buy items with points. When someone purchases the tool with points; everyone gets the tool?
I'm very concerned.
Here's the script:
local Part = game.Workspace.BuyPart
local RS = game:GetService("ReplicatedStorage")
local Sword = RS.Tools:FindFirstChild("SpeedCoil")
local Players = game:GetService("Players")
local Debounce = false
Part.Touched:Connect(function(hit)
local Player = game.Players.LocalPlayer
if Player.leaderstats.Points.Value >= 500 then
if not Debounce then
Debounce = true
Sword.Parent = Player.Backpack
wait(10)
Debounce = false
end
local GravityCoil = RS.Tools:FindFirstChild("GravityCoil")
local Part1 = game.Workspace.BuyPart1
Part1.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if Player.leaderstats.Points.Value >= 7000 then
if not Debounce then
Debounce = true
GravityCoil.Parent = Player.Backpack
wait(10)
Debounce = false
end
local Part2 = game.Workspace.BuyPart2
local Tool = RS.Tools:FindFirstChild("PointGiverTool")
Part2.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if Player.leaderstats.Points.Value >= 10000 then
if not Debounce then
Debounce = true
Tool.Parent = Player.Backpack
wait(10)
Debounce = false
end
end
end
end)
end
end
end)
end
end)

1 comment
Add a variable named coins set it to the amount you want then do coins.Value = coins.Value - Points.Value on line 10 and line 38 and line 24.