Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How Can I Give A Dearkheart To My Friends Using A Script Similar To This?

Asked by
jacobwow 140
10 years ago

I am trying to make a script that gives a dearkheart to my friends when they join my game, it appears though that this one did not work. Can anyone fix it or make a better one?

local VIP = { ["OtherFriend"] = true, ["Friend"] = true }
local Tool = Game:GetService("ServerStorage"):WaitForChild("Darkheart")

Game:GetService("Players").PlayerAdded:connect(function(plr)
    if VIP[plr.Name:lower()] == true then
        Tool:Clone().Parent = plr.Backpack
        Tool:Clone().Parent = plr.StarterGear
    end
end)

1 answer

Log in to vote
2
Answered by
gskw 1046 Moderation Voter
10 years ago

Your code first makes the player's who joined name lowercase, then checks for it in the table. This is the fix:

local VIP = { ["otherfriend"] = true, ["friend"] = true } -- Make all the names here lowercase! Also make sure they are your friends' names.
local Tool = Game:GetService("ServerStorage"):WaitForChild("Darkheart")

Game:GetService("Players").PlayerAdded:connect(function(plr)
    if VIP[plr.Name:lower()] == true then
        Tool:Clone().Parent = plr:WaitForChild(BackPack)
        Tool:Clone().Parent = plr:WaitForChild(StarterGear)
    end
end)

0
it still did not work jacobwow 140 — 10y
0
Try my edited answer gskw 1046 — 10y
Ad

Answer this question