Recently, I’ve been trying to make a plugin. The plugin is similar to team create hats, but it is a plugin for adding characters in studio. I don’t know much about plugins, but I do know that local scripts don’t run on them, which makes me confused on how plugins are able to make client sided guis, or client sided parts. For example, team create hats makes the hat visible for everyone in studio except the one using the plugin, how is client-server communication achieved in the actual Roblox Studio?
Here is my plugin:
local Players = game:GetService("Players")
local name = "[Character Adder]"
local toolbar = plugin:CreateToolbar(name)
local button = toolbar:CreateButton("Chracter Adder", "Tester", "rbxassetid://10164183611")
local activated = false;
local character = nil;
button.Click:Connect(function()
if activated == false then
activated = true
character = Players:CreateHumanoidModelFromUserId(userId)
character.Parent = workspace
for _, part in pairs(character:GetChildren()) do
if part:IsA("BasePart") then
part.Anchored = true
end
end
character.Parent = workspace
while activated do
task.wait()
character:PivotTo(workspace.Camera.CFrame)
end
else
activated = false
character:Destroy()
end
end)
I need to make the parts transparent, or even non existent on the client because it interferes with moving the camera a lot.
local CoreGui = game:GetService("CoreGui")
local gui = CoreGui:FindFirstChild("") or script.Parent.cs -- set the find first child to your ui name
gui.Parent = CoreGui -- just to make sure its in the CoreGui
idk about the second question though, look around in devforums
Also I’ve been searching in the hat plugin modules that I downloaded from github, and I can’t seem to find where the hats are made invisible on the plugin. The rbmx file also doesn’t work as a plugin in general for some reason.
Taking a look at Team Create with Hats source code it appears it uses a property which it calls VisibleLocally which can be found here. However if you take a deeper look into source code that property is just a wrapper to the LocalTransparencyModifier property. So if you take a look at the SetVisibleLocally function you can see that all it is doing is setting the LocalTransparencyModifier of the hat handle to 0 or 1. This is how it hides the hats to the local player.
If you just need the UserID then take a look at this. If you continue to have problems with getting the player I would recommend looking for other DevForum posts or creating a new post with your issue.