I tried making a pickup system, but the script is not detecting if the block is in the player or not. It was suppose to be whenever you activate the proximity prompt it makes a block follow u but when you click a GUI it stops the block from following you.
This is the script I made
while wait() do
if currentSubject.Parent == plr.Character then
currentSubject.Position = Vector3.new(plr.Character:WaitForChild("UpperTorso").Position.X, plr.Character:WaitForChild("UpperTorso").Position.Y, plr.Character:WaitForChild("UpperTorso").Position.Z-2)
currentSubject.Rotation = plr.Character:WaitForChild("UpperTorso").Rotation
elseif currentSubject.Parent ~= plr.Character then
print("dropped block")
end
end
I’ve tried multiple things but it still doesn’t work. Please reply if you know how to fix this.
script.Parent.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
currentSubject.Position = Vector3.new(plr.Character:WaitForChild("UpperTorso").Position.X, plr.Character:WaitForChild("UpperTorso").Position.Y, plr.Character:WaitForChild("UpperTorso").Position.Z-2)
currentSubject.Rotation = plr.Character:WaitForChild("UpperTorso").Rotation
elseif currentSubject.Parent ~= plr.Character then
print("dropped block")
end
You can use ProximityPrompt.Triggered to fire an event that’d make that brick follow you.
I’d recommend you insert a BodyGyop and BodyPosition into your brick to help with stability.
I’ve made a quick [and not the best] way to do that -
Yes, but what I made is that when u activate the proximityprompt it moves the block parent to the player chracter and then I made a gui that when u click it removes it from the player character and change its parent to workspace, but for some reason my script is not detecting that the parent of the block is not the player character.