ply = game.Players.LocalPlayer
mouse = ply:GetMouse()
go = false
Part = script.Parent
--creates function
function Up()
game.Workspace.Part.Anchored = true
game.Workspace.Part.CFrame = game.Workspace.Part.CFrame + CFrame.new(0,0.3,0)
end
--creates loop
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
No errors are popping up, its just that the bottle doesnt move upwards when the mouse is held down I cant figure out why.
The code is in a local script inside of the waterbottle part

3 comments
The LocalScript must be inside the player somehow, such as putting it inside StarterGui or StarterPack.
LocalScripts will only run in the player's Backpack, Character, PlayerGui, PlayerScripts, and ReplicatedFirst.
If you need the script inside the player you can place the script in StarterCharacterScripts, doing this will insert the script into the character.