So I was going to make a clickdetector to player’s body, so player can click it (similar to adopt me)
However, I found that click detector doesnt work when its parented to Player, so i decided to add a new part in workspace and weld to player, However, I can’t weld, can anyone help?
So, you want a part that welds to every player in the game?
It’s just like a part weld to player, every player has their own part with a clickdetector
If so, then make a script that auto welds them:
Instance.new("Part")
part.Size = 4,4,4 - - or any size you choose
Part.Parent = Workspace
Instance.new("Weld")
weld.Part0 = Part
weld.Part1 = - - access any part of the player and put it here
Instance.new("ClickDetector")
ClickDetector.Parent = part
Idk how to do this for every player, I don’t even know idlf it works I’m new and thought of this on the spot, an actual programmer can help you more
Edit: preformatted text is a pain on mobile
local WeldDD = Instance.new("WeldConstraint")
WeldDD.Parent = NewPartForPlayer
WeldDD.Part1 = CharAdded.UpperTorso
WeldDD.Part0 = NewPartForPlayer
this is my part of my script, but I found that Part1 has nothing when i tested
Should I use weld instead of weldconstraint?
Make a variable for a player, maybe something like. local player = game.Players.LocalPlayer.Character
Then from the character you can get each body part? sorry am a scripting newbie
Come to think of it, I prefer constraints more, use any you want though
So the code that @Enk514 put is pretty good, and i’d like to make some modifications.
part = Instance.new("Part")
part.Size = 4,8,4 -- 4 8 4 so it is bigger than the player itself
part.CanCollide = false -- if not then the player would get stuck
part.Parent = game.workspace.YourPlayer'sCharacter.HumanoidRootPart
-- parented it there so it is more organized
--also change YourPlayer'sCharacter to the actual player's name (don't copypaste the script blindly)
part.Name = "ClickPart"
--also you may want to change the Transparency with part.Transparency = 1
weld = Instance.new("Weld")
weld.Part0 = Part
weld.Part1 = game.workspace.YourPlayer'.'sCharacter.HumanoidRootPart
weld.C0 = CFrame.new(Vector3.new(0,0,0))
ClickDetector = Instance.new("ClickDetector")
ClickDetector.Parent = part
Nice, but for the last line of code, don’t you have to make the parent ClickPart cos that’s what you named the instance.new(“Part”) I may be wrong, after all, you’re a programmer and I’m no where near one
Here is not the case, because in this script, the ClickPart is referred as part, “ClickPart” being the name outside the script, and “part” being it’s name inside the script. : )
Hope you understand
This isn’t true. I’ve used click detectors inside entire models before and it worked fine. What is the code your using?
Hey, are you still having trouble with the welds?
I solved them by using Proximity Prompt