Hello, today I was doing a script for when you click a button the handle of the tool ( inside the tools is the gui that can change handle of tool’s BrickColor )
Ok so my issue is that when I try to get the workspace local player name I can’t,
Here is a photo of my script.
local bazul = script.Parent.Frame.azul
local brojo = script.Parent.Frame.rojo
local bverde = script.Parent.Frame.verde
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
bazul.MouseButton1Click:Connect(function()
local Tool = character:FindFirstChild("Tool") or player.Backpack:FindFirstChild("Tool")
if Tool then
local Handle = Tool:FindFirstChild("Handle")
if Handle then
Handle.BrickColor = BrickColor.new(23)
end
end
end)
This should work. The error seems to be occurring because you’re trying to index the frame within the frame but it doesn’t exist.
local bazul = script.Parent.azul
local brojo = script.Parent.rojo
local bverde = script.Parent.verde
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
bazul.MouseButton1Click:Connect(function()
local Tool = character:FindFirstChild("Tool") or player.Backpack:FindFirstChild("Tool")
if Tool then
local Handle = Tool:FindFirstChild("Handle")
if Handle then
Handle.BrickColor = BrickColor.new(23)
end
end
end)