I am trying to make a script inside the Default Roblox sword that changes the texture of the sword IF the person holding it has a specific name.
My issue is that I do not know what to do here, I have tried to find the name of the player by doing a simple “if LocalPlayer.Name == sirvko then”, but that results in a “Attempting to Index nil” error.
I have also tried to do the same thing but for the character instead of the player, but the same thing happened.
This is my first time posting on the DevForum, and I am not a very good scripter.
Code:
local players = game:GetService("Players")
local sirvkoplayer = players.LocalPlayer
if sirvkoplayer.Name == "sirvko" then
script.Parent.Handle.Mesh.TextureId = "rbxassetid://10169518111"
end