Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Bottle does not leave ground? HELP NEEDED!

--creates bottle up on click

mousedown = false
part = script.Parent
starteddown= 0

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()





mouse.Button1Down:connect(function()
	mousedown = true
	while mousedown == true do
		part.Anchored = true
		part.Position = part.Position + Vector3.new(0,0.3, 0)	
		print("Button one down")
	wait()
		end
	
end)












mouse.Button1Up:connect(function()
	mousedown = false
	script.Parent.Anchored = false
end)
		
--need to create down motion 


		
		
		
		
		
		
		
		
		
		
--checks if hit

local part3 = game.Workspace.BOTTLE.Union

part3.Parent.Touched:connect(function(hit)
	local find = hit.Parent:FindFirstChild("top")
	if find ~= nil then
		part3.Anchored = true
	else
		part3.Anchored = false
	end
end)

No errors pop up in the output, the bottle just doesnt leave the table when the mouse is held down

1 comment

0

I'm confused as hell right now. I'll see if I can fix this.

1 answer

Ok here you go:

ply = game.Players.LocalPlayer
mouse = ply:GetMouse()
go = false

function Up()
	game.Workspace.Part.Anchored = true
	game.Workspace.Part.CFrame = game.Workspace.Part.CFrame * CFrame.new(0,0.3,0)
end

while true do
mouse.Button1Down:connect(function()
	go = true
end)
mouse.Button1Up:connect(function()
	go = false
	game.Workspace.Part.Anchored = false
end)
if go == true then
	Up()
else
	game.Workspace.Part.Anchored = false
end
wait(0.1)
end

Just replace part's directory with script.Parent.

8 comments

0

I put this inside a local script. It didn't work. Did you put it in a regualr script?

0

-_- Did you change the directory from game.Workspace.Part to the directory for the bottle. Also I put this in PlayerScripts so my bad.

0

Still nothing...

0

u mean starter player scripts?

0

Yes. Is there any error in the output and you should probably use bodyposition imo.

0

there is no error in the output

0

Please explain the reasoning behind your answer, as it doesn't help the OP to understand why he should do this & that.

0

^^This was posted 7 days ago. This is a basic script and is pretty straightforward so there is no reason to explain what's already there.

This discussion is preserved as it was. New answers, comments, and votes are closed.