I am trying to find a way to find the tool inside the player’s character went they equip it but it does not seem to work. What did I do wrong?
---------------------------------FTN GAMING----------------------------------------------
player = script.Parent.Parent.Parent.Parent.Parent
local function buy(plr)
if script.Parent.Text == "Open Second Lightsaber" then
plr.Character:WaitForChild("YellowLightsaber").Sword2.Transparency = 0
script.Parent.Text = "ClosedLightsaber2"
print("Worked")
elseif script.Parent.Text == "ClosedLightsaber2" then
plr.Character:WaitForChild("YellowLightsaber").Sword2.Transparency = 1
script.Parent.Text = "Open FIrst LightSaber"
end
end
script.Parent.MouseButton1Down:connect(buy)
When a player equipt a Tool it will automatically parented to it’s character found in Workspace.
So what I’m gonna do is:
-- Script
local player = workspace.Roblox --Example only
if player.Character:FindFirstChild("Tool Name") then
print("Tool Name Equipped")
else
print("Not equipped.")
end
---------------------------------FTN GAMING----------------------------------------------
player = script.Parent.Parent.Parent.Parent.Parent
local function buy()
if script.Parent.Text == "Open FIrst LightSaber" then
player.Character:FindFirstChild("YellowLightsaber").Sword1.Transparency = 0
script.Parent.Text = "ClosedLightsaber"
print("Worked")
elseif script.Parent.Text == "ClosedLightsaber" then
player.Character:FindFirstChild("YellowLightsaber").Sword1.Transparency = 0
script.Parent.Text = "Open FIrst LightSaber"
end
end
script.Parent.MouseButton1Down:connect(buy)