Since you've already got your activated event, you can just put the Character variable inside the Activated event using script.Parent.Parent to get the character, the reason for this is because the Tool is going to be inside the player's Character while they are using the Tool right? So then you can use the Players:GetPlayerFromCharacter to then get the player from the player's Character.
local db = false
local tool = script.Parent
tool.Activated:Connect(function()
if not db then
db = true
local Character = script.Parent.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
Player.leaderstats.Technology.Value = Player.leaderstats.Technology.Value + 1
wait(1)
db = false
end
end)
To make it so it gives 500000 Technology to a specific player, you can make an if statement to check if the Player.Name or Player.UserId is equal to your name/UserId, depending on what you want, I'd probably recommend using UserId. If you want multiple players to also have access to this, then you can also use a table and insert the players' UserId's into the table then use table.find() to check if their UserId is in the table.
First Example:
local db = false
local tool = script.Parent
tool.Activated:Connect(function()
if not db then
db = true
local Character = script.Parent.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
if Player.UserId == 283818237 then
Player.leaderstats.Technology.Value = Player.leaderstats.Technology.Value + 500000
else
Player.leaderstats.Technology.Value = Player.leaderstats.Technology.Value + 1
end
wait(1)
db = false
end
end)
Second Example(Table):
local List = {283818237}
local db = false
local tool = script.Parent
tool.Activated:Connect(function()
if not db then
db = true
local Character = script.Parent.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
if table.find(List, Player.UserId) then
Player.leaderstats.Technology.Value = Player.leaderstats.Technology.Value + 500000
else
Player.leaderstats.Technology.Value = Player.leaderstats.Technology.Value + 1
end
wait(1)
db = false
end
end)
Sorry if this was a bit much, lol
2 comments
How Do I Do It With Multiple Id's???
Just insert the player's userid into the table, separate them using commas. You could also use a module script for the table so you can access the table from other scripts if you want to insert a player's userid if they have lets say a certain item, or a gamepass.